go: test: fixedbugs/issue15609.go and fixedbugs/issue29612.go failing on master

$ go version
go version devel +372b0eed17 Wed Aug 28 12:57:59 2019 +0000 linux/amd64
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/mvdan/go/bin"
GOCACHE="/home/mvdan/go/cache"
GOENV="/home/mvdan/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY="brank.as/*"
GONOSUMDB="brank.as/*"
GOOS="linux"
GOPATH="/home/mvdan/go"
GOPRIVATE="brank.as/*"
GOPROXY="https://proxy.golang.org"
GOROOT="/home/mvdan/tip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/mvdan/tip/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-build921353500=/tmp/go-build -gno-record-gcc-switches"
$ cd test
$ go run run.go
# go run run.go -- fixedbugs/issue15609.go
exit status 1
go: cannot find main module; see 'go help modules'

FAIL    fixedbugs/issue15609.go 0.043s
# go run run.go -- fixedbugs/issue29612.go
exit status 1
go: cannot find main module; see 'go help modules'

FAIL    fixedbugs/issue29612.go 0.031s

/cc @bcmills @jayconrod

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (17 by maintainers)

Most upvoted comments

Can we just explicitly set GO111MODULE=off for runindir, or maybe for the entire test?

We could, but then those tests would break if (likely when) GO111MODULE=off goes away at some point. I don’t think we should take on that kind of technical debt, especially given the large effort I’ve already put into making all of the other tests in the repo work seamlessly in both modes.

I don’t mind adding GO111MODULE=off for tests of explicitly GOPATH-specific behavior (such as GOPATH-mode support in the go/build package), but none of the behaviors that these tests are looking for are specific to GOPATH mode.

Ah, if the test is running a go command inside a directory, we may need to follow the model of CL 165498 and add a go.mod file in that directory.