Home > Mobile >  go mod vendor returns "all matched no packages"
go mod vendor returns "all matched no packages"

Time:05-19

I'm trying to setup a new repo that will contain some backend services, named backend. I created the repo, cloned it into /home/me/go/src/github.com/myrepo/backend. I then did the following:

$ go mod init backend
go: creating new go.mod: module backend
go: to add module requirements and sums:
    go mod tidy

$ go mod tidy
go: warning: "all" matched no packages

$ go get -u github.com/snowflakedb/gosnowflake
go: downloading...

$ go mod vendor
go: warning: "all" matched no packages

After all of this, the /vendor/ directory only contains modules.txt and my go.mod file looks like this:

$ cat go.mod
module backend

go 1.18

require (
    github.com/Azure/azure-pipeline-go v0.2.3 // indirect
    github.com/Azure/azure-storage-blob-go v0.15.0 // indirect
    github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
    github.com/aws/aws-sdk-go-v2 v1.16.3 // indirect
    github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.1 // indirect
    github.com/aws/aws-sdk-go-v2/credentials v1.12.1 // indirect
    github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.11 // indirect
    github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.10 // indirect
    github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.4 // indirect
    github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.1 // indirect
    github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.1 // indirect
    github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.5 // indirect
    github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.4 // indirect
    github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.4 // indirect
    github.com/aws/aws-sdk-go-v2/service/s3 v1.26.9 // indirect
    github.com/aws/smithy-go v1.11.2 // indirect
    github.com/form3tech-oss/jwt-go v3.2.5 incompatible // indirect
    github.com/gabriel-vasile/mimetype v1.4.0 // indirect
    github.com/google/flatbuffers v2.0.6 incompatible // indirect
    github.com/google/uuid v1.3.0 // indirect
    github.com/jmespath/go-jmespath v0.4.0 // indirect
    github.com/klauspost/compress v1.15.4 // indirect
    github.com/mattn/go-ieproxy v0.0.6 // indirect
    github.com/pierrec/lz4/v4 v4.1.14 // indirect
    github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
    github.com/sirupsen/logrus v1.8.1 // indirect
    github.com/snowflakedb/gosnowflake v1.6.9 // indirect
    golang.org/x/crypto v0.0.0-20220516162934-403b01795ae8 // indirect
    golang.org/x/net v0.0.0-20220516155154-20f960328961 // indirect
    golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a // indirect
    golang.org/x/text v0.3.7 // indirect
    golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
}

When I do go env I get:

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/me/.cache/go-build"
GOENV="/home/me/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-mod=vendor"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/me/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/me/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.18"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.18/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g  "
CGO_ENABLED="1"
GOMOD="/home/me/go/src/github.com/myrepo/backend/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2382531553=/tmp/go-build -gno-record-gcc-switches"`

I looked around and found this question but, as my module doesn't shadow a standard library package and I haven't actually written any Golang code in it yet, I don't think this is the issue. So, my question is: why am I getting this warning, what should I do about it, and how can I cache packages referenced in go.mod in /vendor/?

CodePudding user response:

As @JimB pointed out, the core issue was that I hadn't written any code in the module yet. As soon as I added some code, the warning went away.

  • Related