environ.go 939 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // SPDX-FileCopyrightText: 2021 Staffan Olsson <naffatso@gmail.com>
  2. //
  3. // SPDX-License-Identifier: MIT
  4. package environ
  5. import "runtime"
  6. var (
  7. // The following variables are set at build time by scripts/build.sh
  8. // GitCommit is the commit of the build
  9. GitCommit string
  10. // BuildTime is the time the exe was built
  11. BuildTime string
  12. // GoOsArch is the OS/architecture for which the exe was built
  13. GoOsArch string
  14. // Version is the git tag of the source
  15. Version string
  16. // APIVersion is from api/version.txt
  17. APIVersion string
  18. // GoVersion is the current version of the go compiler
  19. GoVersion string
  20. )
  21. func init() {
  22. if GitCommit == "" {
  23. GitCommit = "<not set>"
  24. }
  25. if BuildTime == "" {
  26. BuildTime = "<not set>"
  27. }
  28. if GoOsArch == "" {
  29. GoOsArch = "<not set>"
  30. }
  31. if Version == "" {
  32. Version = "<not set>"
  33. }
  34. if APIVersion == "" {
  35. APIVersion = "<not set>"
  36. }
  37. if GoVersion == "" {
  38. GoVersion = runtime.Version()
  39. }
  40. }