Skip to content

Commit

Permalink
Avoid copying flags around, just reuse exising values in memory
Browse files Browse the repository at this point in the history
  • Loading branch information
mback2k committed Dec 25, 2019
1 parent 317068e commit c0d2bed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func parseFlags(flags *flags) {
log.Println(logInfo, "Provided container name or ID:", (*flags).containerName)
}

func handleSignals(ctx context.Context, stop chan<- bool, flags flags) {
func handleSignals(ctx context.Context, stop chan<- bool, flags *flags) {
sigs := make(chan os.Signal, 1)

signal.Notify(sigs, syscall.SIGINT)
Expand Down Expand Up @@ -193,7 +193,7 @@ func handleSignals(ctx context.Context, stop chan<- bool, flags flags) {
}()
}

func workerLoop(ctx context.Context, stop <-chan bool, flags flags) {
func workerLoop(ctx context.Context, stop <-chan bool, flags *flags) {
loop:
for {
cli := createClient()
Expand Down Expand Up @@ -270,8 +270,8 @@ func main() {

stop := make(chan bool)

handleSignals(ctx, stop, flags)
workerLoop(ctx, stop, flags)
handleSignals(ctx, stop, &flags)
workerLoop(ctx, stop, &flags)

close(stop)
}

0 comments on commit c0d2bed

Please sign in to comment.