Hi,
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/nzbMB2v48tyOther 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.
Regards,
Abhishek Varshney