mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-05 13:23:17 +00:00
d2e710716a
controller-gen likes to embed its internal version in generated files. As such, while the generated code is compile time equivalent to official releases, there is some thrashing if some users use nix and others us upstream artefacts. This change patches the version package and runtime value via ldflags.
24 lines
625 B
Diff
24 lines
625 B
Diff
diff --git a/pkg/version/version.go b/pkg/version/version.go
|
|
index 09c8efcf..b9ec798a 100644
|
|
--- a/pkg/version/version.go
|
|
+++ b/pkg/version/version.go
|
|
@@ -20,14 +20,12 @@ import (
|
|
"runtime/debug"
|
|
)
|
|
|
|
+var version string
|
|
+
|
|
// Version returns the version of the main module
|
|
func Version() string {
|
|
- info, ok := debug.ReadBuildInfo()
|
|
- if !ok || info == nil || info.Main.Version == "" {
|
|
- // binary has not been built with module support or doesn't contain a version.
|
|
- return "(unknown)"
|
|
- }
|
|
- return info.Main.Version
|
|
+ _ = debug.ReadBuildInfo
|
|
+ return version
|
|
}
|
|
|
|
// Print prints the main module version on stdout.
|