- Non-
$GOPATH
directory under thego mod
project
$ go mod init test
$ cat go.mod
module test
go 1.12
$ go get github.com/jinzhu/gorm
$ cat go.mod
module test
go 1.12
require github.com/jinzhu/gorm v1.9.8 // indirect
Can be seen in go mod
the next initialization of the project directory go get package
, it will package
be downloaded to $GOPATH/pkg
the directory install , and add or update a file to go.mod
When you want to modify package
the time of release, only go get package@指定的version
, go.mod
will be updated accordingly
- Non-
go mod
Project
$ pwd
/Users/sunnky/go/src/github.com/jinzhu
$ ls
inflection now
$ go get github.com/jinzhu/gorm
$ ls
gorm inflection now
Non- go mod
project execution go get package
, but will package
be downloaded to $GOPATH/src/...
the directory installation
Reproduced in: https: //www.jianshu.com/p/0a2ebb07da54