fix doc and lint warns for the cmd package

This commit is contained in:
mlsmaycon
2021-05-15 15:33:07 +05:00
parent 6d339295be
commit 73720951d7
4 changed files with 11 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ import (
)
const (
// ExitSetupFailed defines exit code
ExitSetupFailed = 1
)
@@ -38,6 +39,7 @@ func init() {
rootCmd.AddCommand(signalCmd)
}
// SetupCloseHandler handles SIGTERM signal and exits with success
func SetupCloseHandler() {
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
@@ -46,10 +48,11 @@ func SetupCloseHandler() {
os.Exit(0)
}
// InitLog parses and sets log-level input
func InitLog(logLevel string) {
level, err := log.ParseLevel(logLevel)
if err != nil {
log.Errorf("efailed parsing log-level %s: %s", logLevel, err)
log.Errorf("Failed parsing log-level %s: %s", logLevel, err)
os.Exit(ExitSetupFailed)
}
log.SetLevel(level)