コード例 #1
0
ファイル: command.go プロジェクト: salsaflow/salsaflow
func runMain(versionString string) error {
	// Make sure the version string is correct.
	task := "Parse the command line VERSION argument"
	ver, err := version.Parse(versionString)
	if err != nil {
		hint := `
The version string must be in the form of Major.Minor.Patch
and no part of the version string can be omitted.

`
		return errs.NewErrorWithHint(task, err, hint)
	}

	// In case -commit is set, set and commit the version string.
	if flagCommit {
		currentBranch, err := gitutil.CurrentBranch()
		if err != nil {
			return err
		}

		_, err = version.SetForBranch(ver, currentBranch)
		return err
	}

	// Otherwise just set the version.
	return version.Set(ver)
}
コード例 #2
0
ファイル: command.go プロジェクト: jkotrlik/salsaflow
func runMain(versionString string) error {
	// Make sure the version string is correct.
	ver, err := version.Parse(versionString)
	if err != nil {
		return err
	}

	// Set the version.
	return version.Set(ver)
}