INNER CODE UNIT · Go

main

kubermatic/kubermatic · cmd/etcd-launcher/main.go:57

func main() {
	log := createLogger()
	ctx := signals.SetupSignalHandler()

	rootCmd := &cobra.Command{
		Use:           "etcd-launcher",
		Short:         "Runs etcd clusters for KKP user cluster control planes",
		SilenceErrors: true,
		Version:       kubermatic.GetVersions().GitVersion,
	}

	// cobra does not make any distinction between "error that happened because of bad flags"
	// and "error that happens because of something going bad inside the RunE function", and
	// so would always show the Usage, no matter what error occurred. To work around this, we
	// set SilenceUsages on all commands and manually print the error using the FlagErrorFunc.
	rootCmd.SetFlagErrorFunc(func(c *cobra.Command, err error) error {
		if err := c.Usage(); err != nil {
			return err

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…