golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.13k stars 17.68k forks source link

cmd/go: go get panic with internal error: can't find reason #61432

Closed Dreamacro closed 1 year ago

Dreamacro commented 1 year ago

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

$ go version
go version go1.20.6 linux/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="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.20"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.20/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.6"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/root/projects/gopanic/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 -fdebug-prefix-map=/tmp/go-build3086296127=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import (
    _ "github.com/ipfs/go-ds-leveldb"
    _ "github.com/libp2p/go-libp2p-kad-dht"
)

func main() {
}

When go mod tidy is executed, the versions of the two packages are:

require (
    github.com/ipfs/go-ds-leveldb v0.5.0
    github.com/libp2p/go-libp2p-kad-dht v0.21.1
)

Try to update github.com/libp2p/go-libp2p-kad-dht, panic appears:

> go get -u github.com/libp2p/go-libp2p-kad-dht
panic: internal error: can't find reason for requirement on github.com/syndtr/goleveldb@v1.0.0

goroutine 1 [running]:
cmd/go/internal/modget.(*resolver).updateBuildList.func1({{0xc0012df380, 0x1b}, {0xc000120e26, 0x6}})
        /usr/lib/go-1.20/src/cmd/go/internal/modget/get.go:1760 +0xd4
cmd/go/internal/modget.(*resolver).updateBuildList(0xc000552000, {0xb47138, 0xc000120000}, {0xc0006ec300, 0x6, 0x8})
        /usr/lib/go-1.20/src/cmd/go/internal/modget/get.go:1765 +0x54c
cmd/go/internal/modget.(*resolver).applyUpgrades(0xc000552000, {0xb47138, 0xc000120000}, {0xc0002e4dc0?, 0x6, 0xc000127d70?})
        /usr/lib/go-1.20/src/cmd/go/internal/modget/get.go:1312 +0x465
cmd/go/internal/modget.runGet({0xb47138, 0xc000120000}, 0xc000146690?, {0xc000136030, 0x1, 0x1})
        /usr/lib/go-1.20/src/cmd/go/internal/modget/get.go:351 +0x458
main.invoke(0xe5f400, {0xc000136010, 0x3, 0x3})
        /usr/lib/go-1.20/src/cmd/go/main.go:225 +0x3d9
main.main()
        /usr/lib/go-1.20/src/cmd/go/main.go:179 +0x7ce

What did you expect to see?

Successful update

What did you see instead?

Go panic

seankhliao commented 1 year ago

fixed in 1.21rc3 / tip

AskAlexSharov commented 1 year ago

@seankhliao hello. Don't need backport fix to go1.20 ?

seankhliao commented 1 year ago

no, see #57358