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: "error loading module requirements" from 'go mod download' #29213

Closed
TPTan96 opened this issue Dec 13, 2018 · 7 comments
Closed

cmd/go: "error loading module requirements" from 'go mod download' #29213

TPTan96 opened this issue Dec 13, 2018 · 7 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@TPTan96
Copy link

TPTan96 commented Dec 13, 2018

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

$ go version
go version go1.11.2 windows/amd64

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

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\tptan\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\tptan\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\tptan\go\src\API\API\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64

What did you do?

Create an image docker

What did you expect to see?

an image

What did you see instead?

Step 6/10 : RUN go mod download
---> Running in 414efa3e565e
go: finding github.com/gorilla/mux v1.6.2
go: github.com/gorilla/mux@v1.6.2: unknown revision v1.6.2
go: error loading module requirements
The command '/bin/sh -c go mod download' returned a non-zero code: 1

@agnivade
Copy link
Contributor

Please mention the exact steps so that we can reproduce this at our end.

What is the Dockerfile ? What is the repo ? Is there a go.mod ?

This is what I get -

$go mod init github.com/agnivade/mux
$go get github.com/gorilla/mux@v1.6.2
go: finding github.com/gorilla/mux v1.6.2
go: downloading github.com/gorilla/mux v1.6.2
$cat go.mod 
module github.com/agnivade/mux

require github.com/gorilla/mux v1.6.2 // indirect

@agnivade agnivade added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 14, 2018
@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Dec 14, 2018
@bcmills bcmills added this to the Go1.13 milestone Dec 14, 2018
@bcmills bcmills changed the title I used "RUN go mod download" but go: error loading module requirements cmd/go: "error loading module requirements" from 'go mod download' Dec 14, 2018
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@varuntechie
Copy link

Facing the same error
" go clean -modcache
go: finding github.com/pkg/errors v0.8.1
go: finding github.com/go-sql-driver/mysql v1.4.1
go: finding github.com/go-goracle/goracle v2.1.14+incompatible
go: github.com/go-goracle/goracle@v2.1.14+incompatible: unknown revision v2.1.14
go: github.com/go-sql-driver/mysql@v1.4.1: unknown revision v1.4.1
go: github.com/pkg/errors@v0.8.1: unknown revision v0.8.1
go: finding gopkg.in/goracle.v2 v2.13.1
go: gopkg.in/goracle.v2@v2.13.1: unknown revision v2.13.1
go: error loading module requirement"

@joshmsamuels
Copy link

I am also encountering this problem.

@alwinmarkcf
Copy link

Some more information would be awesome like:

Could not find module xy because of conflict:
mod ab: xy revision 1.2.0
mod lm: xy revision ^2.0.0

This message is just not useful

@Integralist
Copy link

Yup I'm also getting this and it's unclear why...

# =============================================================================
# build stage
#
# install golang dependencies & build binaries
# =============================================================================
FROM golang:1.12 AS build

# install golint for running rig tests
RUN go get golang.org/x/lint/golint

# set initial working directory
WORKDIR /app

# use go modules to install dependencies
COPY go.mod ./
COPY go.sum ./
RUN go mod download

# copy over the rest of our files
COPY internal ./internal
COPY . ./

# compile our application
RUN go build -ldflags="-s -w" -o /bin/app ./cmd/app

# =============================================================================
# application stage
#
# copy binary from build stage
# =============================================================================
FROM debian:stable-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
COPY scripts/test /app/scripts/test
COPY static/ /app/static
COPY --from=build /bin/app /bin/
CMD ["/bin/app"]

@Integralist
Copy link

Ah, I cracked it.

So ./internal contained not only my application's own code but a symlink to my employer's organization wide packages (lib/**). These are then remapped inside of go.mod like so...

module github.com/foo/bar

go 1.12

require (
	foo/metrics v0.0.0
	foo/settings v0.0.0
	github.com/google/uuid v1.1.1
	github.com/sirupsen/logrus v1.4.1
)

replace (
	foo/metrics => ./internal/lib/metrics
	foo/settings => ./internal/lib/settings
)

I simply had to move that symlink to a ./vendor directory, then update the go.mod to point to that instead, and change the Dockerfile like so...

COPY vendor ./vendor
COPY go.mod ./
COPY go.sum ./
RUN go mod download

@golang golang locked and limited conversation to collaborators Sep 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

8 participants