1 Star 0 Fork 0

Derek Ray/podman

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
version.go 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
Daniel J Walsh 提交于 2018-08-16 06:41 . switch projectatomic to containers
package libpod
import (
"runtime"
"strconv"
podmanVersion "github.com/containers/libpod/version"
)
// Overwritten at build time
var (
// GitCommit is the commit that the binary is being built from.
// It will be populated by the Makefile.
GitCommit string
// BuildInfo is the time at which the binary was built
// It will be populated by the Makefile.
BuildInfo string
)
//Version is an output struct for varlink
type Version struct {
Version string
GoVersion string
GitCommit string
Built int64
OsArch string
}
// GetVersion returns a VersionOutput struct for varlink and podman
func GetVersion() (Version, error) {
var err error
var buildTime int64
if BuildInfo != "" {
// Converts unix time from string to int64
buildTime, err = strconv.ParseInt(BuildInfo, 10, 64)
if err != nil {
return Version{}, err
}
}
return Version{
Version: podmanVersion.Version,
GoVersion: runtime.Version(),
GitCommit: GitCommit,
Built: buildTime,
OsArch: runtime.GOOS + "/" + runtime.GOARCH,
}, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/derekhjray/podman.git
git@gitee.com:derekhjray/podman.git
derekhjray
podman
podman
v0.8.5

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385