File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 go test ./...
1717
1818install :
19- go install ./cmd/aperture
19+ go install -ldflags " $( LDFLAGS ) " ./cmd/aperture
2020
2121clean :
2222 rm -rf .build/
Original file line number Diff line number Diff line change 55 "fmt"
66 "log/slog"
77 "os"
8+ "runtime/debug"
89
910 tea "github.com/charmbracelet/bubbletea"
1011 "github.com/tailscale/aperture-cli/internal/profiles"
2021 buildDate = "unknown"
2122)
2223
24+ func init () {
25+ info , ok := debug .ReadBuildInfo ()
26+ if ! ok {
27+ return
28+ }
29+
30+ if buildVersion == "v0.0.0-dev" && info .Main .Version != "" && info .Main .Version != "(devel)" {
31+ buildVersion = info .Main .Version
32+ }
33+
34+ // Only fill in VCS info when ldflags haven't already set these values.
35+ if buildCommit != "unknown" {
36+ return
37+ }
38+
39+ var dirty bool
40+ for _ , s := range info .Settings {
41+ switch s .Key {
42+ case "vcs.revision" :
43+ if len (s .Value ) >= 7 {
44+ buildCommit = s .Value [:7 ]
45+ }
46+ case "vcs.time" :
47+ if buildDate == "unknown" {
48+ buildDate = s .Value
49+ }
50+ case "vcs.modified" :
51+ dirty = s .Value == "true"
52+ }
53+ }
54+ if dirty && buildCommit != "unknown" {
55+ buildCommit += "-dirty"
56+ }
57+ }
58+
2359func main () {
2460 flag .Parse ()
2561
You can’t perform that action at this time.
0 commit comments