diff --git a/.golangci.yml b/.golangci.yml index c5e8a977..c971fb0c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,4 @@ -# v1.54.2 +# v1.55.0 # Please don't remove the first line. It is used in CI to determine the golangci version run: deadline: 5m @@ -104,4 +104,7 @@ linters: - ifshort - nosnakecase - depguard # Dependency whitelist, needs to be configured + - inamedparam # Fails if interfaces do not have named params. Not in our code style. + - perfsprint # Suggests using strconv.* instead of fmt.* for printing numbers. Not very practical. + - protogetter # Complains when code reads var.Something if var.GetSomething() exists. Not useful. fast: false diff --git a/pkg/iptables/iptables.go b/pkg/iptables/iptables.go index c954a954..5bb72372 100644 --- a/pkg/iptables/iptables.go +++ b/pkg/iptables/iptables.go @@ -43,6 +43,7 @@ import ( const redirectLocalRule = "OUTPUT " + // For local traffic "-t nat " + // Traversing the nat table "-s 127.0.0.0/8 -d 127.0.0.1/32 " + // Coming from and directed to localhost, i.e. not the pod IP. + //nolint:goconst "-p tcp --dport %d " + // Sent to the upstream application's port "-j REDIRECT --to-port %d" // Forward it to the proxy address diff --git a/pkg/runtime/executor_test.go b/pkg/runtime/executor_test.go index b80a8145..d10676ec 100644 --- a/pkg/runtime/executor_test.go +++ b/pkg/runtime/executor_test.go @@ -68,8 +68,7 @@ func Test_Exec(t *testing.T) { if string(out) != tc.expectOutput { t.Errorf( - "returned output does not match expected value.\n"+ - "Expected: %s\nActual: %s\n", + "returned output does not match expected value.\nExpected: %s\nActual: %s", tc.expectOutput, string(out), ) diff --git a/pkg/runtime/fake_test.go b/pkg/runtime/fake_test.go index b6af8f19..873f8d43 100644 --- a/pkg/runtime/fake_test.go +++ b/pkg/runtime/fake_test.go @@ -54,8 +54,7 @@ func Test_FakeExecutor(t *testing.T) { if !errors.Is(err, tc.err) { t.Errorf( - "returned error does not match expected value.\n"+ - "Expected: %v\nActual: %v\n", + "returned error does not match expected value.\nExpected: %v\nActual: %v", tc.err, err, ) @@ -64,8 +63,7 @@ func Test_FakeExecutor(t *testing.T) { if string(out) != string(tc.out) { t.Errorf( - "returned output does not match expected value.\n"+ - "Expected: %s\nActual: %s\n", + "returned output does not match expected value.\nExpected: %s\nActual: %s", string(tc.out), string(out), ) @@ -107,8 +105,7 @@ func Test_MultipleExecutions(t *testing.T) { if !errors.Is(err, tc.err) { t.Errorf( - "returned error does not match expected value.\n"+ - "Expected: %v\nActual: %v\n", + "returned error does not match expected value.\nExpected: %v\nActual: %v", tc.err, err, ) @@ -117,8 +114,7 @@ func Test_MultipleExecutions(t *testing.T) { if string(out) != string(tc.out) { t.Errorf( - "returned output does not match expected value.\n"+ - "Expected: %s\nActual: %s\n", + "returned output does not match expected value.\nExpected: %s\nActual: %s", string(tc.out), string(out), ) @@ -130,8 +126,7 @@ func Test_MultipleExecutions(t *testing.T) { actual := strings.Join(fake.CmdHistory(), "\n") if actual != expected { t.Errorf( - "command history does not match expected value.\n"+ - "Expected: %v\nActual: %v\n", + "command history does not match expected value.\nExpected: %v\nActual: %v", expected, actual, ) @@ -190,8 +185,7 @@ func Test_Callbacks(t *testing.T) { if !errors.Is(err, tc.err) { t.Errorf( - "returned error does not match expected value.\n"+ - "Expected: %v\nActual: %v\n", + "returned error does not match expected value.\nExpected: %v\nActual: %v", tc.err, err, ) @@ -200,8 +194,7 @@ func Test_Callbacks(t *testing.T) { if string(out) != string(tc.out) { t.Errorf( - "returned output does not match expected value.\n"+ - "Expected: %s\nActual: %s\n", + "returned output does not match expected value.\nExpected: %s\nActual: %s", string(tc.out), string(out), )