// getExecutableVersion gets the version of gödel contained in the provided root gödel directory. Invokes the executable
// for the current platform with the "version" task and returns the version determined by that output.
165368
func getExecutableVersion(godelApp specdir.SpecDir) (string, error) {
	executablePath := godelApp.Path(layout.AppExecutable)
	cmd := exec.Command(executablePath, "version")
	output, err := cmd.Output()
	if err != nil {
		return "", errors.Wrapf(err, "failed to execute command %v: %s", cmd.Args, string(output))
	}

	outputString := strings.TrimSpace(string(output))
	parts := strings.Split(outputString, " ")
	if len(parts) != 3 {
		return "", errors.Errorf(`expected output %s to have 3 parts when split by " ", but was %v`, outputString, parts)
	}
	return parts[2], 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
}
726689
func GetVersionFile(exePath string) string {
	// <root>/.versions/exename.cipd_version
	return filepath.Join(filepath.Dir(exePath), ".versions", filepath.Base(exePath)+".cipd_version")
}
303698
func (c *FakeClient) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error) {
	return &rls.GetVersionResponse{
		Version: &version.Version{
			SemVer: "1.2.3-fakeclient+testonly",
		},
	}, nil
}
925872
func (plugin Plugin) ExecutableURL() string {
	systemOS, err := systemOsName()
	if err != nil {
		return ""
	}

	switch systemOS {
	case "Darwin":
		return plugin.Executable.OSX
	case "Linux":
		return plugin.Executable.Linux
	default:
		return ""
	}
}
1079263
func (rdb RethinkDB) GetVersion(gun data.GUN, role data.RoleName, version int) (*time.Time, []byte, error) {
	var file RDBTUFFile
	res, err := gorethink.DB(rdb.dbName).Table(file.TableName(), gorethink.TableOpts{ReadMode: "majority"}).Get([]interface{}{gun.String(), role.String(), version}).Run(rdb.sess)
	if err != nil {
		return nil, nil, err
	}
	defer res.Close()
	if res.IsNil() {
		return nil, nil, ErrNotFound{}
	}
	err = res.One(&file)
	if err == gorethink.ErrEmptyResult {
		return nil, nil, ErrNotFound{}
	}
	return &file.CreatedAt, file.Data, err
}
774122
func getVersion(job *api.Job) uint64 {
	if job.Version != nil {
		return *job.Version
	}

	return 0
}
311241
func (s *RPCServer) GetVersion(args api.GetVersionIn, out *api.GetVersionOut) error {
	out.DelveVersion = version.DelveVersion.String()
	out.APIVersion = s.s.config.APIVersion
	return nil
}
865738
func GetPluginExecutablePath(name string) (string, bool, error) {
	route, found, err := ReadPluginRoute(name)
	if err != nil {
		return "", false, err
	}
	if !found {
		return "", false, fmt.Errorf("plugin not installed with name (%s)", name)
	}

	if route.Executable != "" {
		return filepath.Join(GetPluginBinDir(name), name), true, nil
	}
	return filepath.Join(GetPluginSrcDir(name), pluginScriptFileName), false, nil
}
457751
func GetVersion(uuid []byte) Version {
	ver := uuid[6] >> 4
	if ver > 0 && ver < 6 {
		return Version(ver)
	}

	return VersionUnknown
}
445698
func (version *Version) GetVersion(property *Property, getVersion int) error {
	if getVersion == 0 {
		getVersion = property.LatestVersion
	}

	req, err := client.NewRequest(
		Config,
		"GET",
		fmt.Sprintf(
			"/papi/v1/properties/%s/versions/%d",
			property.PropertyID,
			getVersion,
		),
		nil,
	)
	if err != nil {
		return err
	}

	res, err := client.Do(Config, req)
	if err != nil {
		return err
	}

	if client.IsError(res) {
		return client.NewAPIError(res)
	}

	newVersions := NewVersions()
	if err := client.BodyJSON(res, newVersions); err != nil {
		return err
	}

	version.PropertyVersion = newVersions.Versions.Items[0].PropertyVersion
	version.UpdatedByUser = newVersions.Versions.Items[0].UpdatedByUser
	version.UpdatedDate = newVersions.Versions.Items[0].UpdatedDate
	version.ProductionStatus = newVersions.Versions.Items[0].ProductionStatus
	version.StagingStatus = newVersions.Versions.Items[0].StagingStatus
	version.Etag = newVersions.Versions.Items[0].Etag
	version.ProductID = newVersions.Versions.Items[0].ProductID
	version.Note = newVersions.Versions.Items[0].Note
	version.CreateFromVersion = newVersions.Versions.Items[0].CreateFromVersion
	version.CreateFromVersionEtag = newVersions.Versions.Items[0].CreateFromVersionEtag

	return nil
}
749617
func (h *Client) ApplicationVersion(applicationVersion string) *Client {
	h.applicationVersion = applicationVersion
	h.applicationVersionSet = true
	return h
}
810172
func GetLibraryVersion() (string, error) {
	var version string
	if res := DmGetLibraryVersion(&version); res != 1 {
		return "", ErrGetLibraryVersion
	}
	return version, nil
}
1202920
func OSVersion() (osVersion string, err error) {
	osVersion = runtime.GOOS + "." + runtime.GOARCH
	return
}
91505
func (d *Parallels9Driver) Version() (string, error) {
	out, err := exec.Command(d.PrlctlPath, "--version").Output()
	if err != nil {
		return "", err
	}

	versionRe := regexp.MustCompile(`prlctl version (\d+\.\d+.\d+)`)
	matches := versionRe.FindStringSubmatch(string(out))
	if matches == nil {
		return "", fmt.Errorf(
			"Could not find Parallels Desktop version in output:\n%s", string(out))
	}

	version := matches[1]
	return version, nil
}
138536
func GetVersion() (int, error) {
	output, err := cmd("", "--version")
	if err != nil {
		return -1, err
	}

	return parseVersion(output)
}
1042818
func GetVersionInfo(ctx context.Context, pluginPath string, exec Exec) (version.PluginInfo, error) {
	if exec == nil {
		exec = defaultExec
	}
	args := &Args{
		Command: "VERSION",

		// set fake values required by plugins built against an older version of skel
		NetNS:  "dummy",
		IfName: "dummy",
		Path:   "dummy",
	}
	stdin := []byte(fmt.Sprintf(`{"cniVersion":%q}`, version.Current()))
	stdoutBytes, err := exec.ExecPlugin(ctx, pluginPath, stdin, args.AsEnv())
	if err != nil {
		if err.Error() == "unknown CNI_COMMAND: VERSION" {
			return version.PluginSupports("0.1.0"), nil
		}
		return nil, err
	}

	return exec.Decode(stdoutBytes)
}