當前位置: 首頁>>代碼示例>>Golang>>正文


Golang errs.Fatal函數代碼示例

本文整理匯總了Golang中github.com/salsaflow/salsaflow/errs.Fatal函數的典型用法代碼示例。如果您正苦於以下問題:Golang Fatal函數的具體用法?Golang Fatal怎麽用?Golang Fatal使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Fatal函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: main

func main() {
	// Register the magical -salsaflow.version flag.
	hooks.IdentifyYourself()

	// Run the hook logic itself.
	if err := hook(); err != nil {
		errs.Fatal(err)
	}
}
開發者ID:jkotrlik,項目名稱:salsaflow,代碼行數:9,代碼來源:main.go

示例2: main

func main() {
	// Set up the identification command line flag.
	hooks.IdentifyYourself()

	// Tell the user what is happening.
	fmt.Println("---> Running SalsaFlow pre-push hook")

	// The hook is always invoked as `pre-push <remote-name> <push-url>`.
	if len(os.Args) != 3 {
		fmt.Fprintf(os.Stderr, "Usage: %v <remote-name> <push-url>\n", os.Args[0])
		errs.Fatal(fmt.Errorf("invalid arguments: %#v\n", os.Args[1:]))
	}

	// Run the main function.
	if err := run(os.Args[1], os.Args[2]); err != nil {
		if err != prompt.ErrCanceled {
			fmt.Println()
			errs.Log(err)
		}
		asciiart.PrintGrimReaper("PUSH ABORTED")
		os.Exit(1)
	}

	// Insert an empty line before git push output.
	fmt.Println()
}
開發者ID:salsaflow,項目名稱:salsaflow,代碼行數:26,代碼來源:main.go

示例3: InitOrDie

func InitOrDie() {
	if err := Init(false); err != nil {
		if errs.RootCause(err) != repo.ErrInitialised {
			errs.Fatal(err)
		}
	}
}
開發者ID:jkotrlik,項目名稱:salsaflow,代碼行數:7,代碼來源:app.go

示例4: run

func run(cmd *gocli.Command, args []string) {
	if len(args) != 0 {
		cmd.Usage()
		os.Exit(2)
	}

	upgraded, err := pkg.Upgrade(&pkg.InstallOptions{
		GitHubOwner: flagOwner,
		GitHubRepo:  flagRepo,
	})
	if err != nil {
		if err == pkg.ErrAborted {
			fmt.Println("\nYour wish is my command, exiting now!")
			return
		}
		errs.Fatal(err)
	}

	if upgraded {
		log.Log("SalsaFlow was upgraded successfully")
	} else {
		log.Log("SalsaFlow is up to date")
		asciiart.PrintThumbsUp()
		fmt.Println()
	}
}
開發者ID:salsaflow,項目名稱:salsaflow,代碼行數:26,代碼來源:command.go

示例5: run

func run(cmd *gocli.Command, args []string) {
	if len(args) != 1 {
		cmd.Usage()
		os.Exit(2)
	}

	if err := runMain(args[0]); err != nil {
		errs.Fatal(err)
	}
}
開發者ID:salsaflow,項目名稱:salsaflow,代碼行數:10,代碼來源:command.go

示例6: run

func run(cmd *gocli.Command, args []string) {
	if len(args) != 0 {
		cmd.Usage()
		os.Exit(2)
	}

	app.InitOrDie()

	if err := runMain(); err != nil {
		errs.Fatal(err)
	}
}
開發者ID:salsaflow,項目名稱:salsaflow,代碼行數:12,代碼來源:command.go

示例7: run

func run(cmd *gocli.Command, args []string) {
	if len(args) == 0 {
		cmd.Usage()
		os.Exit(2)
	}

	app.InitOrDie()

	defer prompt.RecoverCancel()

	if err := runMain(args); err != nil {
		errs.Fatal(err)
	}
}
開發者ID:salsaflow,項目名稱:salsaflow,代碼行數:14,代碼來源:command.go

示例8: run

func run(cmd *gocli.Command, args []string) {
	if len(args) != 0 {
		cmd.Usage()
		os.Exit(2)
	}

	if err := app.Init(flagForce); err != nil {
		if errs.RootCause(err) == repo.ErrInitialised {
			log.Log("The repository has been already initialised")
			return
		}
		errs.Fatal(err)
	}
}
開發者ID:salsaflow,項目名稱:salsaflow,代碼行數:14,代碼來源:command.go

示例9: run

func run(cmd *gocli.Command, args []string) {
	app.InitOrDie()

	defer prompt.RecoverCancel()

	var err error
	switch {
	case len(args) != 0:
		err = postRevisions(args...)
	case flagParent != "":
		err = postBranch(flagParent)
	default:
		err = postTip()
	}
	if err != nil {
		errs.Fatal(err)
	}
}
開發者ID:salsaflow,項目名稱:salsaflow,代碼行數:18,代碼來源:command.go

示例10: run

func run(cmd *gocli.Command, args []string) {
	if len(args) != 0 {
		cmd.Usage()
		os.Exit(2)
	}

	app.InitOrDie()

	if err := pkg.Upgrade(&pkg.InstallOptions{flagOwner, flagRepo}); err != nil {
		if err == pkg.ErrAborted {
			fmt.Println("\nYour wish is my command, exiting now!")
			return
		}
		errs.Fatal(err)
	}

	log.Log("SalsaFlow was upgraded successfully")
}
開發者ID:jkotrlik,項目名稱:salsaflow,代碼行數:18,代碼來源:command.go

示例11: init

	// Other
	"gopkg.in/tchap/gocli.v2"
)

var Command = &gocli.Command{
	UsageLine: "version",
	Short:     "various version-related actions",
	Long: `
  Print SalsaFlow version and exit. No more, no less.

  There are also some cool subcommands available. Check them out.
	`,
	Action: func(cmd *gocli.Command, args []string) {
		if len(args) != 0 {
			cmd.Usage()
			os.Exit(2)
		}

		ver, err := version.Get()
		if err != nil {
			errs.Fatal(err)
		}

		fmt.Println(ver)
	},
}

func init() {
	Command.MustRegisterSubcommand(bumpCmd.Command)
}
開發者ID:jkotrlik,項目名稱:salsaflow,代碼行數:30,代碼來源:command.go


注:本文中的github.com/salsaflow/salsaflow/errs.Fatal函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。