Skip to content

Commit

Permalink
lxd: Remove useless break statement in main_callhook command
Browse files Browse the repository at this point in the history
In a select statement, only one case is executed when a channel operation succeeds so once a case is selected and its associated code block is executed, the select statement automatically terminates (there's no fall-through behavior like in a switch statement). So when the response case is selected (i.e., a value is received from the channel), the code inside that case is executed, and then the select statement naturally completes. The break statement here doesn't break out of any additional loop or switch statement; it's just breaking out of the select, which would happen anyway.

Signed-off-by: Gabriel Mougard <[email protected]>
  • Loading branch information
gabrielmougard committed Aug 23, 2024
1 parent 7199dcc commit ced5baa
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion lxd/main_callhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ func (c *cmdCallhook) Run(cmd *cobra.Command, args []string) error {
return err
}

break
case <-time.After(30 * time.Second):
return fmt.Errorf("Hook didn't finish within 30s")
}
Expand Down

0 comments on commit ced5baa

Please sign in to comment.