Safeguard
Supply Chain•

How do you vet a new Go dependency before running go get?

A checklist for judging a Go module before you add it: deprecation, retractions, advisories, init side effects, transitive weight, and maintainer signals.

Safeguard Security Team
3 min read

Before go get, check that the module is not deprecated, that its latest version is not retracted, that it has no known advisories you would inherit, what it pulls in transitively, and what happens at import time. Ten minutes here costs less than removing a dependency later.

Why Go makes this more important

Go has no install scripts, but code you import runs inside your program. The Go team notes that within a build there is no security boundary, since any contributing package can define an init function. Dependencies are trusted code, so vet them like code you would review.

The checklist

  1. Need. Can the standard library do it in a few lines? Fewer modules mean less to maintain.
  2. Identity. Confirm the import path is the real project. Typosquatted paths exist, so copy the path from the project's own documentation and check the repository owner.
  3. Status. Run go list -m -u example.com/module after adding it to a scratch module. Look for a deprecation message or retracted versions. See how to check for deprecation.
  4. Weight. In the scratch module, run go mod graph and count what arrives with it. A small helper that adds forty modules is a bigger decision than it looks.
  5. Advisories. Run a scan on the scratch module. Check the Go vulnerability database at pkg.go.dev/vuln for the module name.
  6. Import side effects. Search the module for func init(), global variables that start goroutines, and network calls on import.
  7. Build features. Look for cgo and for //go:generate directives, which affect what your build needs and runs.
  8. Maintenance. Look at release cadence and how the maintainers handled past security reports. A tagged release history beats a single pseudo-version.
  9. License. Confirm it is compatible with your use. See what pkg.go.dev shows for licenses.
  10. Pin. Add the module at a tagged version, not a branch, and let review see the go.mod and go.sum change.

Quick scoring grid

SignalComfortableNeeds a second look
VersionTagged releasePseudo-version
StatusActiveDeprecated notice
WeightFew transitive modulesDozens of modules
ImportNo side effectsNetwork or goroutines on init

Make it a team habit

Put the checklist in your pull request template for changes that touch go.mod. Reviewers then ask the same questions each time. Pair it with a policy gate so that new dependencies with known critical advisories cannot merge without an exception.

Where Safeguard fits

Safeguard offers SBOM and dependency scanning, reachability analysis and policy gates that apply to pull requests. A free scan lets you check a repository first.

Quick check

Does Go run a dependency's code when I fetch it?

No, but its init functions run once your program imports and starts it.

Is a pseudo-version a red flag?

It is a reason to look closer. It means the commit has no release tag.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.