Skip to content

GOPATH set to GOROOT has no effect #70092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3052 opened this issue Oct 29, 2024 · 4 comments
Closed

GOPATH set to GOROOT has no effect #70092

3052 opened this issue Oct 29, 2024 · 4 comments

Comments

@3052
Copy link

3052 commented Oct 29, 2024

Go version

go version go1.23.2 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\spenny\AppData\Local\go-build
set GOENV=C:\Users\spenny\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\spenny\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\spenny\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\spenny\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\spenny\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.2
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\spenny\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\spenny\AppData\Local\Temp\go-build4205015363=/tmp/go-build -gno-record-gcc-switches

What did you do?

go version

What did you see happen?

warning: GOPATH set to GOROOT (C:\Users\spenny\go) has no effect
go version go1.23.2 windows/amd64

What did you expect to see?

go version go1.23.2 windows/amd64

note I also tried to unset both values:

PS C:\Users\spenny\Desktop> go env -u GOROOT
warning: GOPATH set to GOROOT (C:\Users\spenny\go) has no effect
PS C:\Users\spenny\Desktop> go env -u GOPATH
warning: GOPATH set to GOROOT (C:\Users\spenny\go) has no effect
PS C:\Users\spenny\Desktop> go version
warning: GOPATH set to GOROOT (C:\Users\spenny\go) has no effect
go version go1.23.2 windows/amd64

also:

PS C:\Users\spenny\Desktop> go env -changed
warning: GOPATH set to GOROOT (C:\Users\spenny\go) has no effect

@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@rowanj
Copy link

rowanj commented Nov 26, 2024

I think the bug being reported is that go envshows the Go tooling generated a configuration that it then warns about on every invocation.

The user's environment has neither GOPATH nor GOROOT specified; but Go auto-fills them with values it then considers to be improper.

@ianlancetaylor
Copy link
Contributor

@rowanj Hopefully the fix for #70093 will improve the situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants