summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/config/version/genver/main.go14
-rw-r--r--pkg/version1
2 files changed, 13 insertions, 2 deletions
diff --git a/pkg/config/version/genver/main.go b/pkg/config/version/genver/main.go
index e0d80b0..d4b72d8 100644
--- a/pkg/config/version/genver/main.go
+++ b/pkg/config/version/genver/main.go
@@ -3,6 +3,7 @@ package main
import (
"flag"
"io"
+ "io/ioutil"
"log"
"os"
"os/exec"
@@ -43,7 +44,7 @@ func main() {
vers, err := GitDescribe(dir)
if err != nil {
- log.Fatal(err)
+ vers = ReadVersionFile(dir)
}
vp := VersionPackage{
Name: *flPackageName,
@@ -70,7 +71,7 @@ var packageLayout = `package {{.Name}}
// AUTO-GENERATED. DO NOT EDIT
// {{.Date}}
-// {{.Variable}} is generated by git-describe from gen.go
+// {{.Variable}} is generated by git-describe or static version file from gen.go
var {{.Variable}} = "{{.Version}}"
`
@@ -93,3 +94,12 @@ func GitDescribe(path string) (string, error) {
return strings.TrimSpace(string(buf)), nil
}
+
+func ReadVersionFile(path string) string {
+ versionFile := filepath.Join(path, "../../../version")
+ content, err := ioutil.ReadFile(versionFile)
+ if err != nil {
+ return "unknown"
+ }
+ return strings.Trim(string(content), "\n")
+}
diff --git a/pkg/version b/pkg/version
new file mode 100644
index 0000000..146720c
--- /dev/null
+++ b/pkg/version
@@ -0,0 +1 @@
+0.21.2+git