Manage dependencies

Manage Go dependencies using the go command for version control and govulncheck for security scanning.

Use the go command to manage dependencies by initializing a module, adding packages, and syncing versions. Run go mod init to start, go get to add or update, and go mod tidy to clean up unused entries.

go mod init example.com/myproject
go get github.com/user/package@latest
go mod tidy

For vulnerability checks, use the govulncheck tool with the -version flag to verify your scanner version before scanning your module.

go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...

To control specific runtime behaviors or compatibility settings, set the GODEBUG environment variable or use //go:debug directives in your source files.