Cargo
8 articles
Create and publish module
Initialize a module, tag a version in git, and push the tag to publish your Go module.
go mod tidy vs download
go mod tidy cleans your dependency files, while go mod download only fetches modules to the cache.
Go workspaces
Go workspaces allow managing multiple modules from a single directory using a go.work file for unified builds and tests.
How does go mod work
`go mod` manages Go modules by tracking dependencies in a `go.mod` file and storing resolved versions in a `go.sum` file to ensure reproducible builds.
Manage dependencies
Manage Go dependencies using the go command for version control and govulncheck for security scanning.
Private modules
Configure private Go modules by setting the GOPRIVATE environment variable to bypass the public proxy for specific import paths.
Replace directive
The `godebug` directive in `go.mod` or `go.work` sets default GODEBUG values to control Go runtime behavior and compatibility.
Vendor dependencies
Run go mod vendor to copy all dependencies from go.mod into a local vendor directory for offline builds.