當前位置: 首頁>>代碼示例>>Golang>>正文


Golang semver.NewVersion函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。