Skip to content
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

cmd/go: panic using -mod=vendor when go.mod contains duplicate requirement #47565

Closed
jayconrod opened this issue Aug 5, 2021 · 1 comment
Closed
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@jayconrod
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go version go1.17rc2 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jayconrod/Library/Caches/go-build"
GOENV="/Users/jayconrod/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/jayconrod/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/jayconrod/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go/installed"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/installed/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17rc2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/jayconrod/Code/test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rq/x0692kqj6ml8cvrhcqh5bswc008xj1/T/go-build1836252213=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go list -mod=vendor
-- go.mod --
module m

go 1.17

require example.com/m v0.0.0
require example.com/m v0.0.0

replace example.com/m v0.0.0 => ./m
-- m/go.mod --
module example.com/m

go 1.17
-- m/m.go --
package m
-- use.go --
package use

import _ "example.com/m"
-- vendor/example.com/m/m.go --
package m
-- vendor/modules.txt --
# example.com/m v0.0.0 => ./m
## explicit; go 1.17
example.com/m

What did you expect to see?

m

What did you see instead?

panic: internal error: rs.graph is unexpectedly nil with -mod=vendor

goroutine 1 [running]:
cmd/go/internal/modload.updateLazyRoots({0x166fa00, 0xc0000a0000}, 0xc0001d4a28, 0xc0000b42d0, {0x0, 0x0, 0xc0001d4a58}, {0x0, 0x0, 0x0}, ...)
	/usr/local/go/src/cmd/go/internal/modload/buildlist.go:828 +0xb94
cmd/go/internal/modload.updateRoots({0x166fa00, 0xc0000a0000}, 0x0, 0x203000, {0x0, 0x203000, 0x203000}, {0x0, 0x0, 0x0}, ...)
	/usr/local/go/src/cmd/go/internal/modload/buildlist.go:546 +0x71
cmd/go/internal/modload.requirementsFromModFile({0x166fa00, 0xc0000a0000})
	/usr/local/go/src/cmd/go/internal/modload/init.go:673 +0x5f5
cmd/go/internal/modload.loadModFile({0x166fa00, 0xc0000a0000})
	/usr/local/go/src/cmd/go/internal/modload/init.go:452 +0x451
cmd/go/internal/modload.LoadPackages({0x166fa00, 0xc0000a0000}, {{0x0, 0x0}, 0xc0001a5f50, 0x0, {0x0, 0x0}, 0x0, 0x1, ...}, ...)
	/usr/local/go/src/cmd/go/internal/modload/load.go:327 +0x1f7
cmd/go/internal/load.PackagesAndErrors({0x166fa00, 0xc0000a0000}, {0xf, 0x0, 0x0}, {0xc00009a1a0, 0x0, 0x0})
	/usr/local/go/src/cmd/go/internal/load/pkg.go:2448 +0x1ce
cmd/go/internal/list.runList({0x166fa00, 0xc0000a0000}, 0xc0000ce3c0, {0xc00009a1a0, 0x44, 0x0})
	/usr/local/go/src/cmd/go/internal/list/list.go:505 +0x9f3
main.invoke(0x19832c0, {0xc00009a190, 0x2, 0x2})
	/usr/local/go/src/cmd/go/main.go:216 +0x2f6
main.main()
	/usr/local/go/src/cmd/go/main.go:173 +0x78e

cc @bcmills @matloob

My favorite kind of panic is the kind with a comment above saying it's impossible. 😂

@jayconrod jayconrod added NeedsFix The path to resolution is known, but the work has not been done. release-blocker modules labels Aug 5, 2021
@jayconrod jayconrod added this to the Go1.17 milestone Aug 5, 2021
@jayconrod jayconrod self-assigned this Aug 5, 2021
@gopherbot
Copy link

Change https://golang.org/cl/340252 mentions this issue: cmd/go: with -mod=vendor, don't panic if there are duplicate requirements

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants