Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Apr 28, 2024
1 parent 0f38c47 commit bf2ccb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 1 addition & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ func start(cliCtx *cli.Context) error {

setupLog(c.Log)

agglayer.PrintVersion(os.Stdout)
log.Info("Starting application...")
log.Infof("Starting application... %s", agglayer.GetVersionInfo())

// Prepare DB
pg, err := dbConf.NewSQLDB(c.DB)
Expand Down
18 changes: 12 additions & 6 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ var (

// PrintVersion prints version info into the provided io.Writer.
func PrintVersion(w io.Writer) {
fmt.Fprintf(w, "Version: %s\n", Version)
fmt.Fprintf(w, "Git revision: %s\n", GitRev)
fmt.Fprintf(w, "Git branch: %s\n", GitBranch)
fmt.Fprintf(w, "Go version: %s\n", runtime.Version())
fmt.Fprintf(w, "Built: %s\n", BuildDate)
fmt.Fprintf(w, "OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
fmt.Fprint(w, GetVersionInfo())
}

// GetVersionInfo returns version information as a formatted string.
func GetVersionInfo() string {
versionInfo := fmt.Sprintf("Version: %s\n", Version)
versionInfo += fmt.Sprintf("Git revision: %s\n", GitRev)
versionInfo += fmt.Sprintf("Git branch: %s\n", GitBranch)
versionInfo += fmt.Sprintf("Go version: %s\n", runtime.Version())
versionInfo += fmt.Sprintf("Built: %s\n", BuildDate)
versionInfo += fmt.Sprintf("OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
return versionInfo
}

0 comments on commit bf2ccb4

Please sign in to comment.