本文整理匯總了Golang中github.com/blang/semver.Version.GTE方法的典型用法代碼示例。如果您正苦於以下問題:Golang Version.GTE方法的具體用法?Golang Version.GTE怎麽用?Golang Version.GTE使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/blang/semver.Version
的用法示例。
在下文中一共展示了Version.GTE方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: performVersionNegotiatedRequestsToNSQD
func (s *httpServer) performVersionNegotiatedRequestsToNSQD(
nsqlookupdAddrs []string, nsqdAddrs []string,
deprecatedURI string, v1URI string, queryString string) {
var err error
// get producer structs in one set of up-front requests
// so we can negotiate versions
//
// (this returns an empty list if there are no nsqlookupd configured)
producers, _ := lookupd.GetLookupdProducers(nsqlookupdAddrs)
for _, addr := range nsqdAddrs {
var nodeVer semver.Version
uri := deprecatedURI
producer := producerSearch(producers, addr)
if producer != nil {
nodeVer = producer.VersionObj
} else {
// we couldn't find the node in our list
// so ask it for a version directly
nodeVer, err = lookupd.GetVersion(addr)
if err != nil {
s.ctx.nsqadmin.logf("ERROR: failed to get nsqd %s version - %s", addr, err)
}
}
if nodeVer.NE(semver.Version{}) && nodeVer.GTE(v1EndpointVersion) {
uri = v1URI
}
endpoint := fmt.Sprintf("http://%s/%s?%s", addr, uri, queryString)
s.ctx.nsqadmin.logf("NSQD: querying %s", endpoint)
_, err := http_api.NegotiateV1("POST", endpoint, nil)
if err != nil {
s.ctx.nsqadmin.logf("ERROR: nsqd %s - %s", endpoint, err)
continue
}
}
}
示例2: EnsureDockerInContainer
// Ensures that the Docker daemon is in the desired container.
// Temporarily export the function to be used by dockershim.
// TODO(yujuhong): Move this function to dockershim once kubelet migrates to
// dockershim as the default.
func EnsureDockerInContainer(dockerVersion semver.Version, oomScoreAdj int, manager *fs.Manager) error {
type process struct{ name, file string }
dockerProcs := []process{{dockerProcessName, dockerPidFile}}
if dockerVersion.GTE(containerdVersion) {
dockerProcs = append(dockerProcs, process{containerdProcessName, containerdPidFile})
}
var errs []error
for _, proc := range dockerProcs {
pids, err := getPidsForProcess(proc.name, proc.file)
if err != nil {
errs = append(errs, fmt.Errorf("failed to get pids for %q: %v", proc.name, err))
continue
}
// Move if the pid is not already in the desired container.
for _, pid := range pids {
if err := ensureProcessInContainerWithOOMScore(pid, oomScoreAdj, manager); err != nil {
errs = append(errs, fmt.Errorf("errors moving %q pid: %v", proc.name, err))
}
}
}
return utilerrors.NewAggregate(errs)
}