Context and Problem StatementAs our software project grows in complexity and scale, the risk of introducing security vulnerabilities and code smells increases. Currently, our codebase lacks a consistent and systematic approach to identifying these issues early in the development cycle, leading to higher maintenance costs and potential security breaches in production.
Decision Drivers
Considered Optionsgo vet and govulncheckgo vet, govulncheck, and Snykgo vet, govulncheck, codesweep, and gosecgo vet, govulncheck, Snyk, and golangci-lint
Decision OutcomeChosen option: “Use go vet, govulncheck, Snyk, and golangci-lint”, because this combination of tools provides a comprehensive set of tools for code analysis, vulnerability detection, and security monitoring while also including a powerful linter for Go code.
Implementation Detailsgo vet:
go vet ./... as part of the CI/CD pipeline to catch common coding
mistakes.go vet ./... and review results.govulncheck:
go install golang.org/x/vuln/cmd/govulncheck@latestgovulncheck ./... in the CI/CD pipeline to check for known
vulnerabilities.govulncheck ./... and review results.Snyk:
npm install -g snykcd $WORKSPACE/secrets-managersnyk authsnyk monitor in the CI/CD pipeline.snyk test and review results.golangci-lint:
golangci-lint by following the official documentation.golangci.yml in the project root with
desired linters and settings.golangci-lint run before every release cut and review results.Pre-release manual check:
Positive Consequencesgolangci-lint catches a wide range of issues
Negative Consequencesgolangci-lint
Additional Notes.golangci.yml configuration to ensure it
aligns with project needs and best practices.
ADRsYou can view the ADRs by browsing this following list: