Go
Modules Commands
Manage Go dependencies with modules. Initialize projects, add dependencies, upgrade versions, and understand go.sum for reproducible builds across teams.
12 commands
Pro Tips
Use 'go mod tidy' regularly to remove unused dependencies and add missing ones — keeps go.mod clean.
Use 'go get -u ./...' to update all dependencies, or 'go get -u pkg@latest' for a specific package.
Use 'go mod vendor' to create a vendor directory for offline builds and faster CI.
Common Mistakes
Always commit both go.mod AND go.sum. The sum file ensures dependency integrity and reproducible builds.
Running 'go get -u' updates ALL dependencies including transitive ones. This can introduce breaking changes.