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
parent
0b1c24e079
commit
64b2af609b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue