// getGodelVersion returns the Version returned by "{{projectDir}}/godelw version".
3385
func getGodelVersion(projectDir string) (godelVersion, error) {
	godelw := path.Join(projectDir, "godelw")
	cmd := exec.Command(godelw, "version")
	output, err := cmd.Output()
	if err != nil {
		return godelVersion{}, errors.Wrapf(err, "failed to execute command %v: %s", cmd.Args, string(output))
	}

	// split input on newlines and only consider final line. Do this in case invoking "godelw" causes assets to be
	// downloaded (in which case download messages will be in output before version is printed).
	outputLines := strings.Split(strings.TrimSpace(string(output)), "\n")
	if len(outputLines) == 0 {
		return godelVersion{}, errors.Wrapf(err, "no elements found when splitting output %q on newlines", string(output))
	}
	outputString := outputLines[len(outputLines)-1]

	parts := strings.Split(outputString, " ")
	if len(parts) != 3 {
		return godelVersion{}, errors.Errorf(`expected output %s to have 3 parts when split by " ", but was %v`, outputString, parts)
	}
	v, err := newGodelVersion(parts[2])
	if err != nil {
		return godelVersion{}, errors.Wrapf(err, "failed to create version from output")
	}
	return v, nil
}
876655
func (obj *Global) EngineVersion(ctx context.Context) (*NxEngineVersion, error) {
	result := &struct {
		Version *NxEngineVersion	`json:"qVersion"`
	} {}
	err := obj.rpc(ctx, "EngineVersion", result)
	return result.Version, err 
}
1281881
func Get() (ver Version) {
	var godeps interface{}
	if GODEPS != "" {
		_ = json.Unmarshal([]byte(GODEPS), &godeps)
	}
	if BUILDTIME == "" {
		if exectime, err := getExecModifyTime(); err == nil {
			BUILDTIME = exectime.Format(time.RFC1123)
		}
	}
	return Version{
		Name:      NAME,
		Version:   VERSION,
		GoVersion: runtime.Version(),
		BuildTime: BUILDTIME,
		GitCommit: GITCOMMIT,
		Godeps:    godeps,
	}
}
1337589
func (m *MockMachineProvisioner) ModelAgentVersion() (*version.Number, error) {
	ret := m.ctrl.Call(m, "ModelAgentVersion")
	ret0, _ := ret[0].(*version.Number)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
744347
func GetEngineVersions(ctx context.Context, registryClient registryclient.RegistryClient, registryPrefix, imageName, versionString string) (clitypes.AvailableVersions, error) {

	if imageName == "" {
		var err error
		localMetadata, err := GetCurrentRuntimeMetadata("")
		if err != nil {
			return clitypes.AvailableVersions{}, err
		}
		imageName = localMetadata.EngineImage
	}
	imageRef, err := reference.ParseNormalizedNamed(path.Join(registryPrefix, imageName))
	if err != nil {
		return clitypes.AvailableVersions{}, err
	}

	tags, err := registryClient.GetTags(ctx, imageRef)
	if err != nil {
		return clitypes.AvailableVersions{}, err
	}

	return parseTags(tags, versionString)
}
804480
func GetSemverVersion() (semver.Version, error) {
	return semver.Make(strings.TrimPrefix(GetVersion(), VersionPrefix))
}
526791
func (s *Snapshot) GetVersion(typ string) string {
	if s == nil {
		return ""
	}
	switch typ {
	case EndpointType:
		return s.Endpoints.Version
	case ClusterType:
		return s.Clusters.Version
	case RouteType:
		return s.Routes.Version
	case ListenerType:
		return s.Listeners.Version
	case SecretType:
		return s.Secrets.Version
	}
	return ""
}
1129093
func getVersion() string {
	slurp, err := ioutil.ReadFile(filepath.Join(camliDir, "VERSION"))
	if err == nil {
		return strings.TrimSpace(string(slurp))
	}
	return gitVersion()
}
10981
func (c *ClusterInfo) GetVersion(addr string) (semver.Version, error) {
	endpoint := fmt.Sprintf("http://%s/info", addr)
	var resp struct {
		Version string `json:"version"`
	}
	err := c.client.GETV1(endpoint, &resp)
	if err != nil {
		return semver.Version{}, err
	}
	if resp.Version == "" {
		resp.Version = "unknown"
	}
	return semver.Parse(resp.Version)
}
138536
func GetVersion() (int, error) {
	output, err := cmd("", "--version")
	if err != nil {
		return -1, err
	}

	return parseVersion(output)
}
1058137
func GetVersionProto() *version.Version {
	return &version.Version{
		SemVer:       GetVersion(),
		GitCommit:    GitCommit,
		GitTreeState: GitTreeState,
	}
}
499376
func (c *ControllerAPI) MongoVersion() (params.StringResult, error) {
	result := params.StringResult{}
	if err := c.checkHasAdmin(); err != nil {
		return result, errors.Trace(err)
	}
	version, err := c.state.MongoVersion()
	if err != nil {
		return result, errors.Trace(err)
	}
	result.Result = version
	return result, nil
}
483772
func (s *schemaVersionSyncer) MustGetGlobalVersion(ctx context.Context) (int64, error) {
	startTime := time.Now()
	var (
		err  error
		ver  int
		resp *clientv3.GetResponse
	)
	failedCnt := 0
	intervalCnt := int(time.Second / keyOpRetryInterval)

	defer func() {
		metrics.OwnerHandleSyncerHistogram.WithLabelValues(metrics.OwnerGetGlobalVersion, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds())
	}()
	for {
		if err != nil {
			if failedCnt%intervalCnt == 0 {
				logutil.Logger(ddlLogCtx).Info("[ddl] syncer get global version failed", zap.Error(err))
			}
			time.Sleep(keyOpRetryInterval)
			failedCnt++
		}

		if isContextDone(ctx) {
			err = errors.Trace(ctx.Err())
			return 0, err
		}

		resp, err = s.etcdCli.Get(ctx, DDLGlobalSchemaVersion)
		if err != nil {
			continue
		}
		if len(resp.Kvs) > 0 {
			ver, err = strconv.Atoi(string(resp.Kvs[0].Value))
			if err == nil {
				return int64(ver), nil
			}
		}
	}
}
439076
func GetOSVersion() OSVersion {
	var err error
	osv := OSVersion{}
	osv.Version, err = windows.GetVersion()
	if err != nil {
		// GetVersion never fails.
		panic(err)
	}
	osv.MajorVersion = uint8(osv.Version & 0xFF)
	osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF)
	osv.Build = uint16(osv.Version >> 16)
	return osv
}
1190398
func (tree *MutableTree) GetVersioned(key []byte, version int64) (
	index int64, value []byte,
) {
	if tree.versions[version] {
		t, err := tree.GetImmutable(version)
		if err != nil {
			return -1, nil
		}
		return t.Get(key)
	}
	return -1, nil
}
589945
func (m *Machine) ModelAgentVersion() (*version.Number, error) {
	mc, err := m.st.ModelConfig()
	if err != nil {
		return nil, errors.Trace(err)
	}

	if v, ok := mc.AgentVersion(); ok {
		return &v, nil
	}

	return nil, errors.New("failed to get model's agent version.")
}
373393
func (p *PKGBUILD) Version() string {
	if p.Epoch > 0 {
		return fmt.Sprintf("%d:%s-%s", p.Epoch, p.Pkgver, p.Pkgrel)
	}

	return fmt.Sprintf("%s-%s", p.Pkgver, p.Pkgrel)
}