Closed
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.11rc1 linux/amd64
Does this issue reproduce with the latest release?
Yes, 1.11rc1 is the latest release at the time of writing.
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mart/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mart/go"
GOPROXY=""
GORACE=""
GOROOT="/home/mart/apps/go-1.11-rc1"
GOTMPDIR=""
GOTOOLDIR="/home/mart/apps/go-1.11-rc1/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/mart/Devel/experiment/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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build536392136=/tmp/go-build -gno-record-gcc-switches"
What did you do?
In a new directory, I created a go.mod
file with the following content:
module github.com/apparentlymart/experiment
No other file or directory is present in this directory.
I then ran go mod tidy
.
What did you expect to see?
I expected this to be a no-op, returning to my shell prompt with no error.
(I ran this mainly out of curiosity, not because I expected any particular result.)
What did you see instead?
panic: runtime error: slice bounds out of range
goroutine 1 [running]:
cmd/go/internal/modload.(*mvsReqs).required(0xc0000f4460, 0xc000118960, 0x23, 0x0, 0x0, 0xc00012d4f8, 0x40f639, 0x8e8b40, 0xc0000a8ea8, 0xc00012d598)
/usr/local/go/src/cmd/go/internal/modload/load.go:835 +0x1232
cmd/go/internal/modload.(*mvsReqs).Required.func1(0xc0000bc504, 0x913fe0)
/usr/local/go/src/cmd/go/internal/modload/load.go:765 +0x83
cmd/go/internal/par.(*Cache).Do(0xc0000f4478, 0x913fe0, 0xc0000bc4e0, 0xc00012d708, 0xc00012d8d0, 0xc00012d810)
/usr/local/go/src/cmd/go/internal/par/work.go:128 +0xd6
cmd/go/internal/modload.(*mvsReqs).Required(0xc0000f4460, 0xc000118960, 0x23, 0x0, 0x0, 0xc0000f4460, 0x70, 0x68, 0x925c60, 0x0)
/usr/local/go/src/cmd/go/internal/modload/load.go:764 +0x10f
cmd/go/internal/modcmd.modTidyGoSum.func1(0xc000118960, 0x23, 0x0, 0x0)
/usr/local/go/src/cmd/go/internal/modcmd/tidy.go:80 +0x10b
cmd/go/internal/modcmd.modTidyGoSum()
/usr/local/go/src/cmd/go/internal/modcmd/tidy.go:87 +0x164
cmd/go/internal/modcmd.runTidy(0xd56020, 0xc0000a6080, 0x0, 0x0)
/usr/local/go/src/cmd/go/internal/modcmd/tidy.go:66 +0x513
main.main()
/usr/local/go/src/cmd/go/main.go:218 +0x7d4
It seems that this line is expecting at least one element in r.buildList
:
go/src/cmd/go/internal/modload/load.go
Lines 829 to 837 in 807e7f2