On Thu, Sep 5, 2019 at 9:47 AM <varshneya...@gmail.com> wrote:
>
> I downloaded go version 1.13 and tried to create new test project outside 
> GOPATH. Following is my observation.
> Should I open a bug or it is expected/known behavior?
>
> What version of Go are you using (`go version`)?
> $ go version
> go version go1.13 linux/amd64
>
> Does this issue reproduce with the latest release?
> yes
>
>
> What operating system and processor architecture are you using (`go env`)?
> $ go env
> GO111MODULE=""
> GOARCH="amd64"
> GOBIN="/home/abhishek/myprog/golang/bin"
> GOCACHE="/home/abhishek/.cache/go-build"
> GOENV="/home/abhishek/.config/go/env"
> GOEXE=""
> GOFLAGS=""
> GOHOSTARCH="amd64"
> GOHOSTOS="linux"
> GONOPROXY=""
> GONOSUMDB=""
> GOOS="linux"
> GOPATH="/home/abhishek/myprog/golang"
> GOPRIVATE=""
> GOPROXY="https://proxy.golang.org,direct";
> GOROOT="/home/abhishek/software/go"
> GOSUMDB="sum.golang.org"
> GOTMPDIR=""
> GOTOOLDIR="/home/abhishek/software/go/pkg/tool/linux_amd64"
> GCCGO="gccgo"
> AR="ar"
> CC="gcc"
> CXX="g++"
> CGO_ENABLED="1"
> GOMOD=""
> CGO_CFLAGS="-g -O2"
> CGO_CPPFLAGS=""
> CGO_CXXFLAGS="-g -O2"
> CGO_FFLAGS="-g -O2"
> CGO_LDFLAGS="-g -O2"
> PKG_CONFIG="pkg-config"
> GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 
> -fdebug-prefix-map=/tmp/go-build290715438=/tmp/go-build 
> -gno-record-gcc-switches"
> </pre></details>
>
> What did you do?
> 1. Create folder testmux in non GOPATH folder.
> 2. Create main.go file inside testmux.
> 3. Execute go mod init
> 4. Execute go build
>
> code for 'main.go' is present at:
> https://play.golang.org/p/nzbMB2v48ty
>
> Other Observation
> Executing same steps inside $GOPATH/src, create binary testmux. It does not 
> over write main.go.
>
> What did you expect to see?
> On command 'go build' inside project folder binary with project folder name 
> should be present.
>
> What did you see instead?
> Command 'go build' over writes main.go command with binary (ELF) format. The 
> source code is gone now. Not recoverable.

Where exactly did you create the folder testmux?  What were the exact
commands that you ran?  What was the exact output?

I tried to follow your direction.

> mkdir /tmp/x
> cd /tmp/x
> <create main.go with your contents>
> go mod init
go: cannot determine module path for source directory /tmp/x (outside
GOPATH, module path must be specified)

Example usage:
        'go mod init example.com/m' to initialize a v0 or v1 module
        'go mod init example.com/m/v2' to initialize a v2 module

Run 'go help mod init' for more information.

What did you see when you ran "go mod init"?

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVK7z8bJZyw1FP7MCcxWQ8oTsHCBM2D2yRbj7DqhJKbvw%40mail.gmail.com.

Reply via email to