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: ambiguous import with GOTOOLCHAIN set #62282

Closed
jakecoffman opened this issue Aug 25, 2023 · 1 comment
Closed

cmd/go: ambiguous import with GOTOOLCHAIN set #62282

jakecoffman opened this issue Aug 25, 2023 · 1 comment

Comments

@jakecoffman
Copy link

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

$ go version
go version go1.21.0 linux/arm64

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='arm64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3084179035=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Reproduces with this Dockerfile, just run docker build .

FROM golang:1.21

ENV GOTOOLCHAIN=go1.20

RUN git clone https://github.com/M0NsTeRRR/alertmanager-webhook-free.git \
    && cd alertmanager-webhook-free \
    && go get github.com/prometheus/alertmanager@v0.26.0 \
    && go get

What did you expect to see?

No errors

What did you see instead?

The final go get fails with this error.

20.15 go: upgraded github.com/prometheus/alertmanager v0.25.0 => v0.26.0
20.35 alertmanager-webhook-free: ambiguous import: found package alertmanager-webhook-free in multiple modules:
20.35   alertmanager-webhook-free (/go/alertmanager-webhook-free)
20.35    (/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.20.linux-arm64/src/alertmanager-webhook-free)

It runs without error if I:

  • drop the GOTOOLCHAIN
  • use FROM golang:1.20
  • try the same steps on darwin

It seems the use of GOTOOLCHAIN is creating some kind of path confusion.

@bcmills
Copy link
Contributor

bcmills commented Aug 25, 2023

Duplicate of #61873

@bcmills bcmills marked this as a duplicate of #61873 Aug 25, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Aug 25, 2023
@golang golang locked and limited conversation to collaborators Aug 24, 2024
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