Managing dependencies
Context
Section titled “Context”Go modules are the standard dependency management system. Use go get to add a dependency, go mod tidy to clean up, and go mod vendor to vendor dependencies. The go.mod file records module paths and versions.
Example
Section titled “Example”Add a third‑party dependency and use it.
Code example
Section titled “Code example”go mod init mymodulego get github.com/google/uuidpackage main
import ( "fmt" "github.com/google/uuid")
func main() { id := uuid.New() fmt.Println(id)}Output (example)
Section titled “Output (example)”550e8400-e29b-41d4-a716-446655440000