Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version: Change go_version to based on runtime, add additional #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"runtime"
)

// These values are private which ensures they can only be set with the build flags.
Expand All @@ -42,6 +43,8 @@ type Info struct {
Version string `json:"version"`
Branch string `json:"branch"`
Revision string `json:"revision"`
GoArch string `json:"go_arch"`
GoOs string `json:"go_os"`
GoVersion string `json:"go_version"`
BuildDate string `json:"build_date"`
BuildUser string `json:"build_user"`
Expand All @@ -53,7 +56,9 @@ func Version() Info {
Version: version,
Branch: branch,
Revision: revision,
GoVersion: goVersion,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probable be a TODO to delete this global or mark it as deprecated? I understand not wanting to break any scripts still setting it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swapped it runtime.Version(), which seems a little superfluous with calling runtime. but fits nicely with the PrintFull function. 🤷 Not sure this really gets any use

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that the goVersion variable in the var block is now unused.

GoArch: runtime.GOARCH,
GoOs: runtime.GOOS,
GoVersion: runtime.Version(),
BuildDate: buildDate,
BuildUser: buildUser,
}
Expand All @@ -73,6 +78,8 @@ func PrintFull() {
fmt.Printf(" revision: \t%s\n", v.Revision)
fmt.Printf(" build date: \t%s\n", v.BuildDate)
fmt.Printf(" build user: \t%s\n", v.BuildUser)
fmt.Printf(" go arch: \t%s\n", v.GoArch)
fmt.Printf(" go os: \t%s\n", v.GoOs)
fmt.Printf(" go version: \t%s\n", v.GoVersion)
}

Expand Down