本文整理汇总了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
}
示例2: init
func init() {
sv, err := semver.NewVersion(Version)
if err != nil {
panic("bad version string!")
}
SemVersion = *sv
}
示例3: newFakeRegistryForCheckVersion
func newFakeRegistryForCheckVersion(v string) registry.ClusterRegistry {
sv, err := semver.NewVersion(v)
if err != nil {
panic(err)
}
return registry.NewFakeClusterRegistry(sv, 0)
}
示例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
}
示例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
}
示例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")
}