-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.modules
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.14 windows/amd64
Does this issue reproduce with the latest release?
Yes, as of 1.14
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=REDACTED set GOENV=REDACTED set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=REDACTED set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=c:\go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=c:\go\pkg\tool\windows_amd64 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=REDACTED 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 -fmessage-length=0 -fdebug-prefix-map=REDACTED=/tmp/go-build -gno-record-gcc-switches
What did you do?
Given a module example.com/repo
defined in ./go.mod
, if directory ./a
does not contain any Go files and a package ./a/b
contains import "example.com/repo/a"
, go build ./a/b
will attempt to fetch example.com/repo/a
even though ./a
is clearly within a module.
Reproduced here: https://github.com/firelizzard18/golang-issue-38224
What did you expect to see?
$ go build ./a/b ./a is not a package (it contains no .go files)
What did you see instead?
$ go build ./a/b go: finding module for package github.com/firelizzard18/golang-issue/a a\b\b.go:4:2: no matching versions for query "latest"
go build -c -v ./a/b
Output
$ go build -x -v ./a/b WORK=REDACTED\go-build863876662 go: finding module for package github.com/firelizzard18/golang-issue/a # get https://proxy.golang.org/github.com/@v/list # get https://proxy.golang.org/github.com/firelizzard18/@v/list # get https://proxy.golang.org/github.com/firelizzard18/golang-issue/a/@v/list # get https://proxy.golang.org/github.com/@v/list: 410 Gone (0.136s) # get https://proxy.golang.org/github.com/firelizzard18/@v/list: 410 Gone (0.244s) # get https://proxy.golang.org/github.com/firelizzard18/golang-issue/a/@v/list: 410 Gone (0.250s) # get https://github.com/?go-get=1 mkdir -p REDACTED_GOPATH\pkg\mod\cache\vcs # git3 https://github.com/firelizzard18/golang-issue # lock REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6.lock# REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6 for git3 https://github.com/firelizzard18/golang-issue cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git ls-remote -q origin # get https://github.com/?go-get=1: 200 OK (0.249s) 0.541s # cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git ls-remote -q origin cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49 -- 0.038s # cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49 -- cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git for-each-ref --format %(refname) refs/tags --merged aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49 0.038s # cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git for-each-ref --format %(refname) refs/tags --merged aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49 cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git for-each-ref --format %(refname) refs/tags --merged aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49 0.037s # cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git for-each-ref --format %(refname) refs/tags --merged aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49 cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' aae63bbecdc4 -- 0.038s # cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' aae63bbecdc4 -- cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git cat-file blob aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49:a/go.mod 0.037s # cd REDACTED_GOPATH\pkg\mod\cache\vcs\e2313c495adbffd1d40784db88daaf99dcbe9402845107a75ca579ef28ad5de6; git cat-file blob aae63bbecdc4e4b7f7eb0bde21b827dbb2e3fe49:a/go.mod a\b\b.go:4:2: no matching versions for query "latest"
fdcds
Metadata
Metadata
Assignees
Labels
GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.modules