You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go build .
lib.go:3:8: cannot find package "github.com/jadekler/module-testing-2/v3" in any of:
/usr/local/go/src/github.com/jadekler/module-testing-2/v3 (from $GOROOT)
/Users/deklerk/workspace/go/src/github.com/jadekler/module-testing-2/v3 (from $GOPATH)
However, when I place https://github.com/jadekler/module-testing-2 in /tmp and repeat those steps, everything works. This makes me believe it's looking for v3 in my GOPATH (which it will never find, since it's in a branch). I suspect the subdirectory approach of modules does not have this problem.
The text was updated successfully, but these errors were encountered:
jeanbza
changed the title
cmd/go: unable to build with v2 of same submodule in GOPATH environment
cmd/go: unable to build with v2+ of same module in GOPATH environment
Nov 24, 2018
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have a repo https://github.com/jadekler/module-testing-2 with a v1 and a v3. v3 lives in a separate branch.
I place https://github.com/jadekler/module-testing-2 at $GOPATH/src/github.com/jadekler/module-testing-2 and make v1 depend on v3 (see below), run
go mod tidy
, andgo build .
My altered v1 lib.go:
My altered v1 go.mod:
What did you expect to see?
go mod tidy
works, and downloads v3.go build .
works.What did you see instead?
go mod tidy
works, and downloads v3.go build .
gives error:However, when I place https://github.com/jadekler/module-testing-2 in /tmp and repeat those steps, everything works. This makes me believe it's looking for v3 in my GOPATH (which it will never find, since it's in a branch). I suspect the subdirectory approach of modules does not have this problem.
The text was updated successfully, but these errors were encountered: