Programming Languages
Go
Subjective
Oct 04, 2025
Explain Go modules and dependency management.
Detailed Explanation
Go Modules:
• Dependency management system (Go 1.11+)
• go.mod file defines module
• Semantic versioning
• Minimal version selection
• Replace and exclude directives
Commands:
• go mod init: Initialize module
• go mod tidy: Clean dependencies
• go mod download: Download dependencies
• go mod vendor: Create vendor directory
go.mod example:
module github.com/user/project
go 1.19
require (
github.com/gorilla/mux v1.8.0
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
)
replace github.com/old/package => github.com/new/package v1.0.0
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts