Skip to content
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

cmd/go: go env should include GO111MODULE #29656

Closed
xiaoxiaoyijian123456 opened this issue Jan 10, 2019 · 9 comments

Comments

Projects
None yet
7 participants
@xiaoxiaoyijian123456
Copy link

commented Jan 10, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12beta1 windows/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=F:\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=F:\GOPATH
set GOPROXY=https://goproxy.io
set GORACE=
set GOROOT=E:\Go
set GOTMPDIR=
set GOTOOLDIR=E:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=F:\GOPATH\src\github.com\go-steven\sanle\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\m1358\AppData\Local\Temp\go-build806091146=/tmp/go-build -gno-record-gcc-switches

What did you do?

I have already set the environment variable GO111MODULE to on, but there's no GO111MODULE printed in go env.

What did you expect to see?

go env should print GO111MODULE in Go1.11/1.12...

What did you see instead?

No GO111MODULE printed in go env.

@ALTree ALTree added this to the Go1.13 milestone Jan 10, 2019

@ALTree

This comment has been minimized.

Copy link
Member

commented Jan 10, 2019

GO111MODULE is a temporary env variable that was introduced to help ensure a smooth transition to the module system. I believe we never bothered adding this kind of temporary env vars to go env.

@ALTree

This comment has been minimized.

Copy link
Member

commented Jan 10, 2019

cc @bcmills for decision since you're asking for 1.12 which is almost done.

@bcmills

This comment has been minimized.

Copy link
Member

commented Jan 10, 2019

Why do you need it from go env rather than calling os.Getenv?

It would make module-related issues a bit easier to report, but at this point that seems like relatively little gain, and the environment variable hopefully won't be around forever.

@xiaoxiaoyijian123456

This comment has been minimized.

Copy link
Author

commented Jan 11, 2019

OK, it is just a little problem. Close it.

@shuLhan

This comment has been minimized.

Copy link
Contributor

commented May 13, 2019

@bcmills , Ah ... I may have accidentally skip this when searching for issue. My bad.

If I can argue, even its temporary, there are quite long time range before GO111MODULE will be removed (unused). The next release is still default to auto [1], and until Go 1.13 unsupported (two releases after that) there is about one and half years after that.

Since the change is not that big (one line) [2], maybe temporary adding it to go env give more clarity and benefit in issue reporting rather than not.

BTW, thank you for reviewing the CL.

[1] #31857
[2] https://go-review.googlesource.com/c/go/+/176837

@bcmills bcmills reopened this May 14, 2019

@bcmills bcmills added modules and removed WaitingForInfo labels May 14, 2019

@bcmills bcmills changed the title cmd/go: go env should print GO111MODULE in Go1.11/1.12... cmd/go: go env should include GO111MODULE May 14, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented May 14, 2019

@jayconrod

This comment has been minimized.

Copy link
Contributor

commented May 14, 2019

Why is go env GO111MODULE actually needed? If you need to check whether modules are enabled, go env GOMOD is a better way to do that.

@gopherbot

This comment has been minimized.

Copy link

commented May 14, 2019

Change https://golang.org/cl/176837 mentions this issue: internal/envcmd: print GO111MODULE when executing "go env"

@rsc

This comment has been minimized.

Copy link
Contributor

commented May 16, 2019

Yes please, if only so it shows up in 'go bug' reports so we can better diagnose problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.