@@ -17,8 +17,10 @@ package cmd
17
17
import (
18
18
"fmt"
19
19
"os"
20
+ "path/filepath"
20
21
"runtime"
21
22
"runtime/debug"
23
+ "strings"
22
24
"text/tabwriter"
23
25
24
26
"github.com/gookit/color"
43
45
// Dirty represents whether or not the git repo was dirty when the software was built.
44
46
Dirty = vcs ("vcs.modified" , "unknown" )
45
47
48
+ // PGOEnabled represents whether or not the build leveraged Profile-Guided Optimization (PGO).
49
+ PGOEnabled = vcs ("-pgo" , "false" )
50
+
46
51
versionCmd = & cobra.Command {
47
52
Use : "version" ,
48
53
Short : "Long-form version information" ,
@@ -59,6 +64,9 @@ version, and external dependencies.`,
59
64
if Dirty == "true" {
60
65
fmt .Fprintf (w , " Dirty repo:\t %s\t \n " , Dirty )
61
66
}
67
+ if ! strings .Contains (PGOEnabled , "false" ) {
68
+ fmt .Fprintf (w , " PGO:\t %s\t \n " , filepath .Base (PGOEnabled ))
69
+ }
62
70
fmt .Fprintf (w , " Build date:\t %s\t \n " , BuildDate )
63
71
fmt .Fprintf (w , " OS/Arch:\t %s/%s\t \n " , runtime .GOOS , runtime .GOARCH )
64
72
fmt .Fprintf (w , " System:\t %s\t \n " , archstring .GetFriendlyName (runtime .GOOS , runtime .GOARCH ))
@@ -89,6 +97,14 @@ version, and external dependencies.`,
89
97
exiterrorf .ExitErrorf (err )
90
98
}
91
99
100
+ // if info, ok := debug.ReadBuildInfo(); ok {
101
+ // for i := range info.Settings {
102
+ // setting := info.Settings[i]
103
+
104
+ // fmt.Printf("%s = %s\n", setting.Key, setting.Value)
105
+ // }
106
+ // }
107
+
92
108
fmt .Println ("" )
93
109
},
94
110
}
0 commit comments