apppackio / apppack

Exit inside non-main function RVV-A0003
Anti-pattern
Major
5 occurrences in this check
calls to log.Fatal only in main() or init() functions
125func tempFilePath() string {
126	file, err := os.CreateTemp("", "")
127	if err != nil {
128		log.Fatal(err)129	}
130	os.Remove(file.Name())
131	return file.Name()
calls to os.Exit only in main() or init() functions
129	} else {
130		printError(err.Error())
131	}
132	os.Exit(1)133}
134
135func printError(text string) {
calls to os.Exit only in main() or init() functions
101	// run command
102	if err := rootCmd.Execute(); err != nil {
103		fmt.Println(err)
104		os.Exit(1)105	}
106
107	updateCancel() // if the update checker hasn't completed by now, abort it
calls to os.Exit only in main() or init() functions
133	}
134
135	waitStatus := cmd.ProcessState.Sys().(syscall.WaitStatus)
136	os.Exit(waitStatus.ExitStatus())137	return nil
138}
139
calls to os.Exit only in main() or init() functions
 619	if err != nil {
 620		fmt.Println(aurora.Red("AWS Session Manager plugin was not found on the path. Install it locally to use this feature."))
 621		fmt.Println(aurora.White("https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html"))
 622		os.Exit(1) 623	}
 624	region := a.Session.Config.Region
 625	arg1, err := json.Marshal(ecsSession)