From f969531205948660edf56fb47faec879a892475e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 29 Oct 2019 01:49:41 +0100 Subject: [PATCH] cli/command/service: SA1012: do not pass a nil Context (staticcheck) ``` cli/command/service/update_test.go:31:16: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck) updateService(nil, nil, flags, spec) ^ cli/command/service/update_test.go:535:16: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck) updateService(nil, nil, flags, spec) ^ cli/command/service/update_test.go:540:16: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck) updateService(nil, nil, flags, spec) ^ ``` Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 8d64c2af1af90f12e43ebd510ee09767bdf42ce8) Signed-off-by: Sebastiaan van Stijn --- cli/command/service/update_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cli/command/service/update_test.go b/cli/command/service/update_test.go index 6eeea55a1f..fbabdf2bbf 100644 --- a/cli/command/service/update_test.go +++ b/cli/command/service/update_test.go @@ -28,7 +28,7 @@ func TestUpdateServiceArgs(t *testing.T) { cspec := spec.TaskTemplate.ContainerSpec cspec.Args = []string{"old", "args"} - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, is.DeepEqual([]string{"the", "new args"}, cspec.Args)) } @@ -532,18 +532,18 @@ func TestUpdateReadOnly(t *testing.T) { // Update with --read-only=true, changed to true flags := newUpdateCommand(nil).Flags() flags.Set("read-only", "true") - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, cspec.ReadOnly) // Update without --read-only, no change flags = newUpdateCommand(nil).Flags() - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, cspec.ReadOnly) // Update with --read-only=false, changed to false flags = newUpdateCommand(nil).Flags() flags.Set("read-only", "false") - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, !cspec.ReadOnly) } @@ -558,18 +558,18 @@ func TestUpdateInit(t *testing.T) { // Update with --init=true flags := newUpdateCommand(nil).Flags() flags.Set("init", "true") - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, is.Equal(true, *cspec.Init)) // Update without --init, no change flags = newUpdateCommand(nil).Flags() - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, is.Equal(true, *cspec.Init)) // Update with --init=false flags = newUpdateCommand(nil).Flags() flags.Set("init", "false") - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, is.Equal(false, *cspec.Init)) } @@ -584,18 +584,18 @@ func TestUpdateStopSignal(t *testing.T) { // Update with --stop-signal=SIGUSR1 flags := newUpdateCommand(nil).Flags() flags.Set("stop-signal", "SIGUSR1") - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, is.Equal("SIGUSR1", cspec.StopSignal)) // Update without --stop-signal, no change flags = newUpdateCommand(nil).Flags() - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, is.Equal("SIGUSR1", cspec.StopSignal)) // Update with --stop-signal=SIGWINCH flags = newUpdateCommand(nil).Flags() flags.Set("stop-signal", "SIGWINCH") - updateService(nil, nil, flags, spec) + updateService(context.TODO(), nil, flags, spec) assert.Check(t, is.Equal("SIGWINCH", cspec.StopSignal)) }