Skip to content

Commit

Permalink
lxd-agent: Ignore linter complaints about deep exit
Browse files Browse the repository at this point in the history
In this case we need it to ensure non-zero exit code is returned.

Signed-off-by: Thomas Parrott <[email protected]>
  • Loading branch information
tomponline committed Jun 27, 2024
1 parent d34bfbe commit 70c0d45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lxd-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func main() {
// Run the main command and handle errors
err := app.Execute()
if err != nil {
os.Exit(1)
// Ensure we exit with a non-zero exit code.
os.Exit(1) //nolint:revive
}
}
6 changes: 4 additions & 2 deletions lxd-agent/main_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func (c *cmdAgent) Run(cmd *cobra.Command, args []string) error {
// Setup logger.
err := logger.InitLogger("", "lxd-agent", c.global.flagLogVerbose, c.global.flagLogDebug, nil)
if err != nil {
os.Exit(1)
// Ensure we exit with a non-zero exit code.
os.Exit(1) //nolint:revive
}

logger.Info("Starting")
Expand Down Expand Up @@ -196,7 +197,8 @@ func (c *cmdAgent) Run(cmd *cobra.Command, args []string) error {
cancelStatusNotifier() // Ensure STOPPED status is written to QEMU status ringbuffer.
cancelFunc()

os.Exit(exitStatus)
// Ensure we exit with a relevant exit code.
os.Exit(exitStatus) //nolint:revive

return nil
}
Expand Down

0 comments on commit 70c0d45

Please sign in to comment.