Documentation ¶
Overview ¶
User should run: # To retrieve the latest commit hash export VERSION=$(git rev-list -1 HEAD) # Following command is used to build a Go program with custom values set for variables at compile time go build -ldflags "-X main.VERSION=$VERSION" gitVersion.go In one line: export VERSION=$(git rev-list -1 HEAD) && go build -ldflags "-X main.VERSION=$VERSION" gitVersion.go │ After that, program can be run using: ./gitVersion version And the output will be the version hash for the new program.
Click to show internal directories.
Click to hide internal directories.