get github.com/gorilla/mux@latest # records v1.6.2 $ go get github.com/gorilla/[email protected] # records v1.6.2 $ go get github.com/gorilla/mux@e3702bed2 Changes to go get
get github.com/gorilla/mux@latest # records v1.6.2 $ go get github.com/gorilla/[email protected] # records v1.6.2 $ go get github.com/gorilla/mux@e3702bed2 # records v0.0.0-20180517173623-c85619274f5d $ go get github.com/gorilla/mux@c856192 Changes to go get
get github.com/gorilla/mux@latest # records v1.6.2 $ go get github.com/gorilla/[email protected] # records v1.6.2 $ go get github.com/gorilla/mux@e3702bed2 # records v0.0.0-20180517173623-c85619274f5d $ go get github.com/gorilla/mux@c856192 # records current meaning of master $ go get github.com/gorilla/mux@master Changes to go get
modules to local cache edit edit go.mod from tools or scripts fix make go.mod semantically consistent graph print module requirement graph init initialize new module in current directory tidy add missing and remove unused modules vendor make vendored copy of dependencies verify verify dependencies have expected content why explain why packages or modules are needed go mod commands
$ cd ~/go/src/github.com/go-gitea/gitea # set a env var and check why do we use this dependency $ export GO111MODULE=on $ go mod why github.com/RoaringBitmap/roaring # github.com/RoaringBitmap/roaring code.gitea.io/gitea/modules/indexer github.com/blevesearch/bleve github.com/blevesearch/bleve/index/scorch github.com/RoaringBitmap/roaring go mod why
# will clone repo into $HOME/gohack/example.com/foo/bar # will add: replace example.com/foo/bar /home/rog/gohack/example.com/foo/bar gohack by Roger Peppe
# will clone repo into $HOME/gohack/example.com/foo/bar # will add: replace example.com/foo/bar /home/rog/gohack/example.com/foo/bar $ cat go.mod replace example.com/foo/bar => /home/rog/gohack/example.com/foo/bar gohack by Roger Peppe
$ gohack get example.com/foo/bar # will clone repo into $HOME/gohack/example.com/foo/bar # will add: replace example.com/foo/bar /home/rog/gohack/example.com/foo/bar $ cat go.mod replace example.com/foo/bar => /home/rog/gohack/example.com/foo/bar # to remove specific replace: $ gohack undo example.com/foo/bar # to remove all replaces: $ gohack undo