Skip to content

Commit

Permalink
fix: modify code to be compliant to lint pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
alegrey91 committed Jan 21, 2023
1 parent 2619487 commit 2ad08e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)
Expand All @@ -25,7 +26,10 @@ var daemonCmd = &cobra.Command{
Use: "daemon",
Short: "Run fwdctl as deamon",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
err := cmd.Help()
if err != nil {
fmt.Println(err)
}
},
}

Expand Down
9 changes: 7 additions & 2 deletions internal/daemon/management.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ func Start(rulesFile string) {
errorLogger.Println(err)
os.Exit(1)
}
defer removePidFile()
defer func() {
err = removePidFile()
}()
infoLogger.Println("PID file created")

// preparing rule set from rules file
Expand Down Expand Up @@ -122,5 +124,8 @@ func Stop() {
if err != nil {
errorLogger.Println(err)
}
syscall.Kill(pid, syscall.SIGTERM)
err = syscall.Kill(pid, syscall.SIGTERM)
if err != nil {
errorLogger.Println(err)
}
}

0 comments on commit 2ad08e4

Please sign in to comment.