mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 23:50:32 +00:00
088e187e6a
So we can receive pull requests to improve it :)
36 lines
732 B
Go
36 lines
732 B
Go
package utils
|
|
|
|
const version = "0.9.2-dev"
|
|
|
|
var (
|
|
commit = ""
|
|
date = ""
|
|
versionInfo VersionInfo
|
|
)
|
|
|
|
// VersionInfo defines version details
|
|
type VersionInfo struct {
|
|
Version string `json:"version"`
|
|
BuildDate string `json:"build_date"`
|
|
CommitHash string `json:"commit_hash"`
|
|
}
|
|
|
|
// GetVersionAsString returns the string representation of the VersionInfo struct
|
|
func (v *VersionInfo) GetVersionAsString() string {
|
|
versionString := v.Version
|
|
if len(v.CommitHash) > 0 {
|
|
versionString += "-" + v.CommitHash
|
|
}
|
|
if len(v.BuildDate) > 0 {
|
|
versionString += "-" + v.BuildDate
|
|
}
|
|
return versionString
|
|
}
|
|
|
|
func init() {
|
|
versionInfo = VersionInfo{
|
|
Version: version,
|
|
CommitHash: commit,
|
|
BuildDate: date,
|
|
}
|
|
}
|