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: confusing error message when downloading modules with no internet connection #33995

Open
Russiancold opened this issue Aug 31, 2019 · 0 comments

Comments

@Russiancold
Copy link

commented Aug 31, 2019

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

$ go version
1.12.9

Does this issue reproduce with the latest release?

Yes

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

go env GOOS=linux GOARCH=amd64
$ go env

What did you do?

I've tried to build my go app with modules in docker.

FROM golang:1.12.9 as builder

ENV GO111MODULE=on
WORKDIR /app

COPY go.mod .
COPY go.sum .

RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o encashment


FROM scratch
COPY --from=builder /app/encashment /encashment/
EXPOSE 8080
ENTRYPOINT ["/app/encashment"]

The problem was that my docker had no internet connection and go mod download couldn't load packages. I was very confused with an error message it returns. Suddenly, I don't know exactly what was wrong and how to reproduce this properly. But I did:

pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d

And this worked for me.

What did you expect to see?

Error message informing that something is wrong with internet connection.

What did you see instead?

go: finding github.com/gorilla/mux v1.7.3
go: github.com/gorilla/mux@v1.7.3: unknown revision v1.7.3
go: error loading module requirements

@smasher164 smasher164 changed the title Confusing error message from go mod in case of no internet connection. cmd/go: confusing error message when downloading modules with no internet connection Aug 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.