github.com/cryptohub-digital/blockbook-fork@v0.0.0-20230713133354-673c927af7f1/common/version.go (about)

     1  package common
     2  
     3  import "runtime"
     4  
     5  var (
     6  	version   = "unknown"
     7  	gitcommit = "unknown"
     8  	buildtime = "unknown"
     9  )
    10  
    11  // VersionInfo holds information about the running Blockbook instance
    12  type VersionInfo struct {
    13  	Version   string `json:"version"`
    14  	GitCommit string `json:"gitcommit"`
    15  	BuildTime string `json:"buildtime"`
    16  	GoVersion string `json:"goversion"`
    17  	OSArch    string `json:"os/arch"`
    18  }
    19  
    20  // GetVersionInfo returns VersionInfo of the running Blockbook instance
    21  func GetVersionInfo() VersionInfo {
    22  	return VersionInfo{
    23  		Version:   version,
    24  		GitCommit: gitcommit,
    25  		BuildTime: buildtime,
    26  		GoVersion: runtime.Version(),
    27  		OSArch:    runtime.GOOS + "/" + runtime.GOARCH,
    28  	}
    29  }