-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from auth0/cli-39
- Loading branch information
Showing
4 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package buildinfo | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
) | ||
|
||
var ( | ||
Version string | ||
Revision string | ||
Branch string | ||
BuildUser string | ||
BuildDate string | ||
GoVersion = runtime.Version() | ||
) | ||
|
||
type BuildInfo struct { | ||
Version string | ||
Revision string | ||
Branch string | ||
BuildUser string | ||
BuildDate string | ||
GoVersion string | ||
} | ||
|
||
// NewDefaultBuildInfo returns the build information obtained from ldflags | ||
func NewDefaultBuildInfo() BuildInfo { | ||
return NewBuildInfo(Version, Branch, BuildDate, BuildUser, GoVersion, Revision) | ||
} | ||
|
||
// NewBuildInfo returns an object with the build information | ||
func NewBuildInfo(version, branch, buildDate, buildUser, goVersion, revision string) BuildInfo { | ||
return BuildInfo{ | ||
Version: version, | ||
Branch: branch, | ||
BuildDate: buildDate, | ||
BuildUser: buildUser, | ||
GoVersion: goVersion, | ||
Revision: revision, | ||
} | ||
} | ||
|
||
func GetVersionWithCommit() string { | ||
return fmt.Sprintf("%v %v", Version, Revision) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters