Documentation
¶
Overview ¶
Package tools provides auto-installation for external tools.
Installation Strategy ¶
Tools are installed using `go install <import-path>@<commit-hash>` which provides: - Immutable pinning: commit hashes never change (unlike tags which can be moved) - Reproducible builds: same commit always produces same binary - Security: we control exact source code being compiled
Version Pinning ¶
Commit hashes are used instead of version tags because: - Git tags can be deleted or moved to different commits - Commit SHA-256 hashes are cryptographically immutable - Go modules convert commit hashes to pseudo-versions automatically
Example: go install github.com/aquasecurity/trivy/cmd/trivy@9aabfd2 Go converts to: v0.0.0-20250205xxxxxx-9aabfd2 (pseudo-version)
Updating Tool Versions ¶
To update a tool: 1. Find the release on GitHub (e.g., github.com/aquasecurity/trivy/releases) 2. Get the commit hash for that release tag 3. Update the Version field in the Tool struct 4. Test with `go install <import-path>@<new-commit-hash>`
Never use short commit hashes in production - always use at least 7 characters for collision resistance (Go will accept and expand them).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Trivy vulnerability scanner - pinned to v0.59.1 (commit 9aabfd2). Trivy = Tool{ Name: "trivy", ImportPath: "github.com/aquasecurity/trivy/cmd/trivy", Version: "9aabfd2", } // Dockle container image linter - pinned to v0.4.15 (commit 5436857). Dockle = Tool{ Name: "dockle", ImportPath: "github.com/goodwithtech/dockle/cmd/dockle", Version: "5436857", } )
Functions ¶
This section is empty.
Types ¶
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer manages tool installation.
func NewInstaller ¶
NewInstaller creates a new tool installer.
func (*Installer) Ensure ¶
Ensure ensures the tool is installed and available. Returns the path to the tool binary.
func (*Installer) GetToolPath ¶
GetToolPath returns the expected path for a tool in GOPATH/bin or GOBIN.