container-structure-test: add ldflags w/ version

Minor update to `go build` to pass -ldflags and include the build time & version
Closes https://github.com/GoogleContainerTools/container-structure-test/issues/312

remove time require

add -s -w flags

Closes #117230.

Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
master
Thomas Cooper 2022-12-03 15:01:14 -05:00 committed by BrewTestBot
parent 0b1c24e079
commit 64b2af609b
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
1 changed files with 7 additions and 1 deletions

View File

@ -26,7 +26,13 @@ class ContainerStructureTest < Formula
end
def install
system "go", "build", *std_go_args, "./cmd/container-structure-test"
project = "github.com/GoogleContainerTools/container-structure-test"
ldflags = %W[
-s -w
-X #{project}/pkg/version.version=#{version}
-X #{project}/pkg/version.buildDate=#{time.iso8601}
]
system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/container-structure-test"
end
test do