zrepl/version/version.go

32 lines
672 B
Go
Raw Normal View History

2018-08-26 21:57:19 +02:00
package version
import (
"fmt"
2018-08-27 15:22:32 +02:00
"runtime"
2018-08-26 21:57:19 +02:00
)
var (
zreplVersion string // set by build infrastructure
)
type ZreplVersionInformation struct {
Version string
RuntimeGOOS string
RuntimeGOARCH string
RUNTIMECompiler string
}
func NewZreplVersionInformation() *ZreplVersionInformation {
return &ZreplVersionInformation{
Version: zreplVersion,
RuntimeGOOS: runtime.GOOS,
RuntimeGOARCH: runtime.GOARCH,
RUNTIMECompiler: runtime.Compiler,
}
}
func (i *ZreplVersionInformation) String() string {
return fmt.Sprintf("zrepl version=%s GOOS=%s GOARCH=%s Compiler=%s",
i.Version, i.RuntimeGOOS, i.RuntimeGOARCH, i.RUNTIMECompiler)
}