This is a small program used to test Trivy's
ability to detect versions set in a binary via go build -ldflags='<FLAGS>'
.
-
Run
go build -ldflags='-X main.version=1.0.0' -o bin/test.elf .
-
Verify that
go version -m bin/test.elf | grep -F 'main.version=1.0.0'
outputsbuild -ldflags="-X main.version=1.0.0"
-
Modify any Go build variables as needed to test edge cases e.g.
$GOOS
,$GOARCH
, etc.
MIT