Skip to content

cmd/go: go test std should give a clearer error with GO111MODULE=off #81364

Open

Description

@dmitshur

Go version

go version go1.27.1 darwin/arm64

What did you do?

Prior to filing this issue, I forgot that it was already decided and documented that testing the Go standard library with GO111MODULE=auto or GO111MODULE=off is not supported (see go help gopath and issue #69202). Consider what happens if someone attempts to do it anyway:

$ go test net/http
$ GO111MODULE=off go test net/http

What did you see happen?

$ go test net/http
ok  	net/http	13.379s
$ GO111MODULE=off go test net/http
< 3186407 bytes of output, which are unhelpful as testing standard library packages
  with GO111MODULE111=off is unsupported and known to produce false positive signal >

What did you expect to see?

$ go test net/http
ok  	net/http	13.379s
$ GO111MODULE=off go test net/http
go: modules disabled by GO111MODULE=off; see 'go help gopath'

Or some better phrasing - see related issue #66080 about go get error clarity.

Implementing this might be tricky since it'd have to be done without also breaking the ability for cmd/go tests themselves to test this mode (given proposal #60915), but if it can be done somehow it may reduce possibility of confusion in the future.

CC @matloob (via https://dev.golang.org/owners).

Activity

  1. added this to the Backlog milestone on Sep 4, 2026
  2. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Sep 4, 2026
  3. added
    BadErrorMessageIssues related compiler error messages that should be better.
    on Sep 4, 2026
  4. self-assigned this
    on Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BadErrorMessageIssues related compiler error messages that should be better.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions