Search code examples
govgo

Where is the module cache in golang?


When I enable gomodules and build my go program then the required packages are downloaded.

But I cannot find them in $GOPATH/src/ or in $GOPATH/src/mod.

Where are they stored?

export GO111MODULE=on
go mod init
go build main.go 
go: finding github.com/sirupsen/logrus v1.0.6
go: downloading github.com/sirupsen/logrus v1.0.6
...

Solution

  • For Go 1.11, they are stored in

    $GOPATH/pkg/mod