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: Using go get to upgrade a dependency throws error in 1.17 #47764

Closed
fishy opened this issue Aug 17, 2021 · 3 comments
Closed

cmd/go: Using go get to upgrade a dependency throws error in 1.17 #47764

fishy opened this issue Aug 17, 2021 · 3 comments

Comments

@fishy
Copy link

fishy commented Aug 17, 2021

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

$ go version
go version go1.17 linux/amd64

Does this issue reproduce with the latest release?

This is the latest release.

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

go env Output
$ go env | grep -v GOPRIVATE
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fishy/.cache/go-build"
GOENV="/home/fishy/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/fishy/.gopath/pkg/mod"
GONOPROXY="github.snooguts.net"
GONOSUMDB="github.snooguts.net"
GOOS="linux"
GOPATH="/home/fishy/.gopath"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/fishy/work/reddit/baseplate.go/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-build3697274393=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm trying to update a dependency using go get:

$ grep zap go.mod
        go.uber.org/zap v1.15.0
$ go get go.uber.org/zap@latest
go: downloading go.uber.org/zap v1.19.0
go: downloading go.uber.org/atomic v1.7.0
go: downloading go.uber.org/multierr v1.6.0
# runtime/internal/sys
/usr/local/go/src/runtime/internal/sys/stubs.go:9:7: PtrSize redeclared in this block
        /usr/local/go/src/runtime/internal/sys/arch.go:24:38: previous declaration
/usr/local/go/src/runtime/internal/sys/stubs.go:10:24: undefined: Uintreg
/usr/local/go/src/runtime/internal/sys/stubs.go:16:7: StackGuardMultiplier redeclared in this block
        /usr/local/go/src/runtime/internal/sys/arch.go:27:74: previous declaration

I tried to upgrade a few different dependencies and all got the same error from runtime/internal/sys. This works when I use go 1.16. When using go 1.17 it always break, regardless the go directive in go.mod file (I've tried both 1.16 and 1.17)

What did you expect to see?

It should work as in go 1.16

What did you see instead?

@fishy
Copy link
Author

fishy commented Aug 17, 2021

Additional note: it throws the same error if I use a specific version instead of latest:

$ go get go.uber.org/zap@v1.19.0
# runtime/internal/sys
/usr/local/go/src/runtime/internal/sys/stubs.go:9:7: PtrSize redeclared in this block
        /usr/local/go/src/runtime/internal/sys/arch.go:24:38: previous declaration
/usr/local/go/src/runtime/internal/sys/stubs.go:10:24: undefined: Uintreg
/usr/local/go/src/runtime/internal/sys/stubs.go:16:7: StackGuardMultiplier redeclared in this block
        /usr/local/go/src/runtime/internal/sys/arch.go:27:74: previous declaration

@ianlancetaylor
Copy link
Contributor

It looks like you unpacked Go 1.17 over an existing Go installation. Don't do that: unpack it in an empty directory. The files src/runtime/internal/sys/stubs.go and src/runtime/internal/sys/arch.go existed in Go 1.16 and earlier releases but were removed in Go 1.17.

@fishy
Copy link
Author

fishy commented Aug 17, 2021

oops sorry I though I deleted the older version.

@golang golang locked and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants