本文整理汇总了Golang中github.com/coreos/fleet/Godeps/_workspace/src/github.com/coreos/go-semver/semver.NewVersion函数的典型用法代码示例。如果您正苦于以下问题:Golang NewVersion函数的具体用法?Golang NewVersion怎么用?Golang NewVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewVersion函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
sv, err := semver.NewVersion(strings.TrimPrefix(Version, "v"))
if err != nil {
panic(fmt.Sprintf("bad version string: %v", err))
}
SemVersion = *sv
}
开发者ID:Roskowski101,项目名称:fleet,代码行数:7,代码来源:version.go
示例2: init
func init() {
sv, err := semver.NewVersion(Version)
if err != nil {
panic("bad version string!")
}
SemVersion = *sv
}
开发者ID:hugoduncan,项目名称:fleet,代码行数:7,代码来源:version.go
示例3: newFakeRegistryForCheckVersion
func newFakeRegistryForCheckVersion(v string) registry.ClusterRegistry {
sv, err := semver.NewVersion(v)
if err != nil {
panic(err)
}
return registry.NewFakeClusterRegistry(sv, 0)
}
开发者ID:ericcapricorn,项目名称:fleet,代码行数:8,代码来源:fleetctl_test.go
示例4: newFakeRegistryForCheckVersion
func newFakeRegistryForCheckVersion(v string) registry.Registry {
sv, err := semver.NewVersion(v)
if err != nil {
panic(err)
}
reg := registry.NewFakeRegistry()
reg.SetLatestVersion(*sv)
return reg
}
开发者ID:hugoduncan,项目名称:fleet,代码行数:10,代码来源:fleetctl_test.go
示例5: LatestDaemonVersion
// LatestDaemonVersion attempts to retrieve the latest version of fleetd
// that has been registered in the Registry. It returns the version if
// it can be determined (or nil otherwise), and any error encountered.
func (r *EtcdRegistry) LatestDaemonVersion() (*semver.Version, error) {
machs, err := r.Machines()
if err != nil {
if etcd.IsKeyNotFound(err) {
err = nil
}
return nil, err
}
var lv *semver.Version
for _, m := range machs {
v, err := semver.NewVersion(m.Version)
if err != nil {
continue
} else if lv == nil || lv.LessThan(*v) {
lv = v
}
}
return lv, nil
}
开发者ID:ngpestelos,项目名称:fleet,代码行数:22,代码来源:version.go
示例6: LatestVersion
//NOTE(bcwaldon): This is only temporary until a better version negotiation mechanism is in place
func (c *HTTPClient) LatestVersion() (*semver.Version, error) {
return semver.NewVersion("0.0.0")
}
开发者ID:BillTheBest,项目名称:fleet,代码行数:4,代码来源:http.go
注:本文中的github.com/coreos/fleet/Godeps/_workspace/src/github.com/coreos/go-semver/semver.NewVersion函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论