- How modules work
- See also workspaces doc after
- Modules are how Go manages dependencies
- Modules collect related packages
- Modules expose packages to other modules
go mod init company.com/foo;
go mod tidy;
cd $PROJ_ROOT;
rm -vf ./go.mod;
rm -vf ./go.sum;
go clean -modcache;
go mod init wcarmon.com/codegen;
go mod tidy;
cd /dir/with/go.mod/
go mod tidy;
go mod edit -replace github.com/dave/dst=github.com/hawkinsw/dst@generics
// in go.mod
replace example.com/original/import/path => /your/forked/import/path
replace example.com/original/import/path => ../relative/dir/to/another/go.mod/
- commit
go.sum
andgo.mod
files
- Goland will auto-import new dependencies only after you setup a module
go list -u -m -f '{{if .Update}}{{.}}{{end}}' all
go list -u -m -json all | $HOME/go/bin/go-mod-outdated;
- replace directives should be replaced with workspaces
- TODO: mention package cycles