本文整理匯總了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")
}