We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6398d4f + d4194bb commit 7d2d49cCopy full SHA for 7d2d49c
cmd/version.go
@@ -18,6 +18,7 @@ package cmd
18
19
import (
20
"fmt"
21
+ "runtime/debug"
22
23
"github.com/spf13/cobra"
24
)
@@ -33,7 +34,15 @@ var versionCmd = &cobra.Command{
33
34
goc version
35
`,
36
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println(version)
37
+ // if it is "Unstable", means user build local or with go get
38
+ if version == "Unstable" {
39
+ if info, ok := debug.ReadBuildInfo(); ok {
40
+ fmt.Println(info.Main.Version)
41
+ }
42
+ } else {
43
+ // otherwise the value is injected in CI
44
+ fmt.Println(version)
45
46
},
47
}
48
0 commit comments