Skip to content

cmd/go: bad error message when using vendor directory while specifying too old Go version #67587

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
dominikh opened this issue May 22, 2024 · 1 comment
Assignees
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dominikh
Copy link
Member

Go version

go version devel go1.23-722d59436b Thu May 16 02:00:26 2024 +0000 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/dominikh/.cache/go-build'
GOENV='/home/dominikh/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/dominikh/prj/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/dominikh/prj'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/dominikh/prj/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/dominikh/prj/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-722d59436b Thu May 16 02:00:26 2024 +0000'
GODEBUG=''
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/tmp/foo/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3571202171=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Run go build in

-- foo.go --
package foo

import _ "github.com/foo/bar"
-- go.mod --
module example.com

go 1.13
-- vendor/github.com/foo/bar/bar.go --
package bar

What did you see happen?

foo.go:3:8: cannot find module providing package github.com/foo/bar: import lookup disabled by -mod=readonly
	(Go version in go.mod is unspecified, so vendor directory was not used.)

What did you expect to see?

I did not expect to see Go version in go.mod is unspecified since a version is specified, it's just too old (older than 1.14) for Go to default to -mod=vendor

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels May 22, 2024
@matloob matloob self-assigned this May 23, 2024
@matloob matloob added this to the Go1.23 milestone May 23, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/588075 mentions this issue: cmd/go/internal/modload: fix bug in error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants