On Thu, Sep 26, 2019 at 7:36 PM Dan Kortschak <d...@kortschak.io> wrote: > > I am looking at some changes we have made to make code generation > independent of GOPATH since from the SettingGOPATH page of the wiki > says "If no GOPATH is set, it is assumed to be $HOME/go on Unix systems > and %USERPROFILE%\go on Windows." > > However, when I run `go env` I see `missing $GOPATH` in response. > > ``` > ~ $ go env > GO111MODULE="on" > GOARCH="amd64" > GOBIN="/home/user/bin" > GOCACHE="/home/user/.cache/go-build" > GOENV="/home/user/.config/go/env" > GOEXE="" > GOFLAGS="" > GOHOSTARCH="amd64" > GOHOSTOS="linux" > GONOPROXY="" > GONOSUMDB="" > GOOS="linux" > GOPATH="/home/user" > GOPRIVATE="" > GOPROXY="https://proxy.golang.org,direct" > GOROOT="/home/user/go" > GOSUMDB="sum.golang.org" > GOTMPDIR="" > GOTOOLDIR="/home/user/go/pkg/tool/linux_amd64" > GCCGO="gccgo" > AR="ar" > CC="gcc" > CXX="g++" > CGO_ENABLED="1" > GOMOD="/dev/null" > 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-build038144482=/tmp/go-build -gno-record-gcc-switches" > ~ $ unset GOPATH > ~ $ go env > missing $GOPATH > ``` > > Is this expected now?
The problem you are encountering is that /home/user/go is already being used for GOROOT, so it can't be used for GOPATH. If the default location is unavailable, there is no fallback, so you get "missing $GOPATH". 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/CAOyqgcXj-DG3XwjmvN9s53s7gzxjextQHmW-y4xi7iSTqNATzg%40mail.gmail.com.