Created
December 20, 2019 08:33
-
-
Save grantpullen/d5136bd3d20f7ca5472fd55481a7e2c8 to your computer and use it in GitHub Desktop.
Save git build info in Golang linux exec built within Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set GOARCH=amd64 | |
set GOOS=linux | |
set NOW=%date% %time% | |
rem save the results from 'git describe --tags --dirty --always' to variable 'GINFO' | |
for /f %%i in ('git describe --tags --dirty --always') do set GINFO=%%i | |
rem set var GitInfo & var BuildDate in the go code | |
go build -ldflags "-X 'main.GitInfo=%GINFO%' -X 'main.BuildDate=%NOW%'" -o ./bin/gw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment