You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
GOARCH="amd64" GOOS="linux"
What did you do?
Use go get in a directory that has a go.mod.
What did you expect to see?
The package to be installed.
What did you see instead?
# net
exec: "gcc": executable file not found in $PATH
Reproducible example
The reproducible example will attempt to go getgit.colasdn.top/goreleaser/goreleaser. When it gets to the net dependency it will attempt to use gcc when a go.mod file is present in the directory. If CGO_ENABLED=0 is prepended onto the go get command it will not require gcc. Or, if there is no go.mod it will not require gcc.
1. go get without go.mod (success)
FROM debian:stretch
RUN apt-get update
RUN apt-get -y install git curl
# go - installRUN curl https://dl.google.com/go/go1.11.linux-amd64.tar.gz | tar xz -C /usr/local
ENV GOPATH="$HOME/go"ENV PATH="${PATH}:/usr/local/go/bin:$GOPATH/bin"# homeENV HOME="/root"# working directoryWORKDIR $HOME
# install goreleaserRUN go get github.com/goreleaser/goreleaser
Output:
Step 9/9 : RUN go get github.com/goreleaser/goreleaser
---> Running in d922d741415c
Removing intermediate container d922d741415c
---> 4b1cebf13425
Successfully built 4b1cebf13425
Successfully tagged reproduce-26307-1:latest
2. go get with go.mod (failure)
FROM debian:stretch
RUN apt-get update
RUN apt-get -y install git curl
# go - installRUN curl https://dl.google.com/go/go1.11.linux-amd64.tar.gz | tar xz -C /usr/local
ENV GOPATH="$HOME/go"ENV PATH="${PATH}:/usr/local/go/bin:$GOPATH/bin"# homeENV HOME="/root"# working directoryWORKDIR $HOME
# install goreleaserRUN cd $HOME && go mod init github.com/hello/world && go get github.com/goreleaser/goreleaser
Output:
Step 9/9 : RUN cd $HOME && go mod init github.com/hello/world && go get github.com/goreleaser/goreleaser
---> Running in 4d3ac4ccddaa
go: creating new go.mod: module github.com/hello/world
go: finding github.com/goreleaser/goreleaser v0.86.1
go: downloading github.com/goreleaser/goreleaser v0.86.1
...
go: downloading github.com/google/go-querystring v1.0.0
go: finding golang.org/x/net latest
go: downloading golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3
# net
exec: "gcc": executable file not found in $PATH
The command '/bin/sh -c cd $HOME && go mod init github.com/hello/world && go get github.com/goreleaser/goreleaser' returned a non-zero code: 2
3. CGO_ENABLED=0 go get with go.mod (success)
FROM debian:stretch
RUN apt-get update
RUN apt-get -y install git curl
# go - installRUN curl https://dl.google.com/go/go1.11.linux-amd64.tar.gz | tar xz -C /usr/local
ENV GOPATH="$HOME/go"ENV PATH="${PATH}:/usr/local/go/bin:$GOPATH/bin"# homeENV HOME="/root"# working directoryWORKDIR $HOME
# install goreleaserRUN cd $HOME && go mod init github.com/hello/world && CGO_ENABLED=0 go get github.com/goreleaser/goreleaser
Output:
Step 9/9 : RUN cd $HOME && go mod init github.com/hello/world && CGO_ENABLED=0 go get github.com/goreleaser/goreleaser
---> Running in 2679e852359a
go: creating new go.mod: module github.com/hello/world
go: finding github.com/goreleaser/goreleaser v0.86.1
go: downloading github.com/goreleaser/goreleaser v0.86.1
...
go: downloading github.com/google/go-querystring v1.0.0
go: finding golang.org/x/net latest
go: downloading golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3
Removing intermediate container 2679e852359a
---> 45beab603aa4
Successfully built 45beab603aa4
Successfully tagged reproduce-26307-3:latest
The text was updated successfully, but these errors were encountered:
It's not that cgo wouldn't be used otherwise; rather, without modules the library would already be cached (i.e., included in the go toolchain's binary distribution).
What version of Go are you using (
go version
)?go version go1.11 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOOS="linux"
What did you do?
Use
go get
in a directory that has ago.mod
.What did you expect to see?
The package to be installed.
What did you see instead?
Reproducible example
The reproducible example will attempt to
go get
github.com/goreleaser/goreleaser
. When it gets to thenet
dependency it will attempt to usegcc
when ago.mod
file is present in the directory. IfCGO_ENABLED=0
is prepended onto thego get
command it will not requiregcc
. Or, if there is nogo.mod
it will not requiregcc
.1.
go get
without go.mod (success)Output:
2.
go get
with go.mod (failure)Output:
3.
CGO_ENABLED=0 go get
withgo.mod
(success)Output:
The text was updated successfully, but these errors were encountered: