diff options
author | ZauberNerd <[email protected]> | 2022-03-14 21:22:12 +0000 |
---|---|---|
committer | Ayke <[email protected]> | 2022-03-19 15:36:44 +0100 |
commit | d066b5c2323af9667a57897e0bf2e0778abf3e9e (patch) | |
tree | 4c40253dc3832697041167eab5d97fa24a2d49de /goenv | |
parent | 836ab95192348999271bef4b532fc062a8039361 (diff) | |
download | tinygo-d066b5c2323af9667a57897e0bf2e0778abf3e9e.tar.gz tinygo-d066b5c2323af9667a57897e0bf2e0778abf3e9e.zip |
Move gitSha1 build time variable from main to goenv package
Moving and exporting this variable from the main to the goenv package
allows us to use it from both the main and the builder package.
This is done in preparation to include the value in `tinygo build`
linker flags, so that we can embed the version and git sha into binaries
built with tinygo.
Diffstat (limited to 'goenv')
-rw-r--r-- | goenv/version.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/goenv/version.go b/goenv/version.go index 2e4e5a676..7142491c3 100644 --- a/goenv/version.go +++ b/goenv/version.go @@ -14,6 +14,12 @@ import ( // Update this value before release of new version of software. const Version = "0.23.0-dev" +var ( + // This variable is set at build time using -ldflags parameters. + // See: https://stackoverflow.com/a/11355611 + GitSha1 string +) + // GetGorootVersion returns the major and minor version for a given GOROOT path. // If the goroot cannot be determined, (0, 0) is returned. func GetGorootVersion(goroot string) (major, minor int, err error) { |