What causes "Pattern matched no module dependencies" when using go mod download?

Coming there from the similar issue by running Dockerfile.

Dockerfile:

ENV GO111MODULE=on
RUN go mod download
RUN go mod verify

Try enabling go modules. This works for me with go 1.12

GO111MODULE=on go mod download

Note: If you're working inside $GOPATH/src, go modules are disabled by default and can be enabled by setting GO111MODULE=on.

From https://blog.golang.org/using-go-modules,

(Inside $GOPATH/src, for compatibility, the go command still runs in the old GOPATH mode, even if a go.mod is found. See the go command documentation for details.)


I have had the same issue and I resolved it by changing the version of go to v1.11.9.

go mod download
go: modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules'

export GO111MODULE=on

Tags:

Module

Go