本文整理匯總了Golang中github.com/coreos/fleet/registry.Registry.LatestVersion方法的典型用法代碼示例。如果您正苦於以下問題:Golang Registry.LatestVersion方法的具體用法?Golang Registry.LatestVersion怎麽用?Golang Registry.LatestVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/coreos/fleet/registry.Registry
的用法示例。
在下文中一共展示了Registry.LatestVersion方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: checkVersion
// checkVersion makes a best-effort attempt to verify that fleetctl is at least as new as the
// latest fleet version found registered in the cluster. If any errors are encountered or fleetctl
// is >= the latest version found, it returns true. If it is < the latest found version, it returns
// false and a scary warning to the user.
func checkVersion(reg registry.Registry) (string, bool) {
fv := version.SemVersion
lv, err := reg.LatestVersion()
if err != nil {
log.Errorf("error attempting to check latest fleet version in Registry: %v", err)
} else if lv != nil && fv.LessThan(*lv) {
return fmt.Sprintf(oldVersionWarning, fv.String(), lv.String()), false
}
return "", true
}