Skip to content

Managing dependencies

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.

Add a third‑party dependency and use it.

Terminal window
go mod init mymodule
go get github.com/google/uuid
package main
import (
"fmt"
"github.com/google/uuid"
)
func main() {
id := uuid.New()
fmt.Println(id)
}
Terminal window
550e8400-e29b-41d4-a716-446655440000