You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/tool/kratos/version.go

44 lines
804 B

package main
import (
"bytes"
"runtime"
"text/template"
)
var (
// Version is version
Version = "0.3.0"
// BuildTime is BuildTime
BuildTime = "2019/07/19"
)
// VersionOptions include version
type VersionOptions struct {
GitCommit string
Version string
BuildTime string
GoVersion string
Os string
Arch string
}
var versionTemplate = ` Version: {{.Version}}
Go version: {{.GoVersion}}
Built: {{.BuildTime}}
OS/Arch: {{.Os}}/{{.Arch}}
`
func getVersion() string {
var doc bytes.Buffer
vo := VersionOptions{
Version: Version,
BuildTime: BuildTime,
GoVersion: runtime.Version(),
Os: runtime.GOOS,
Arch: runtime.GOARCH,
}
tmpl, _ := template.New("version").Parse(versionTemplate)
tmpl.Execute(&doc, vo)
return doc.String()
}