Skip to content

Instantly share code, notes, and snippets.

@Demznak
Last active May 4, 2021 18:58
Show Gist options
  • Save Demznak/fb71fa10ccb9c0d2c2725f66e72fcec5 to your computer and use it in GitHub Desktop.
Save Demznak/fb71fa10ccb9c0d2c2725f66e72fcec5 to your computer and use it in GitHub Desktop.
go dependency management
Quick start
# Dependency Management
go get -d github.com/path/to/module # add or upgrade dep
go get -d github.com/dep/two/[email protected] # use specific version
go get -d github.com/dep/commit@branch # use specific branch
go get -d -u ./... # upgrade all modules used in subdirs
go get -d github.com/dep/legacy@none # remove dep
# Useful commands
go mod tidy # organize and clean up go.mod and go.sum
go mod download # download deps into module cache
go mod init github.com/path/to/module # initialize new module
go mod why -m github.com/path/to/module # why is the module a dependency?
go install github.com/path/to/bin@latest # build and install a binary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment