kubernetes-sigs / ip-masq-agent

Manage IP masquerade on nodes
Apache License 2.0
217 stars 70 forks source link

Lint failures #110

Closed jingyuanliang closed 8 months ago

jingyuanliang commented 1 year ago
Running golangci-lint: FAIL
cmd/ip-masq-agent/ip-masq-agent.go:274:24: Error return value of `m.iptables.EnsureChain` is not checked (errcheck)
    m.iptables.EnsureChain(utiliptables.TableNAT, masqChain)
                          ^
cmd/ip-masq-agent/ip-masq-agent_test.go:35:10: Error return value of `flag.Set` is not checked (errcheck)
    flag.Set("logtostderr", "false")
            ^
cmd/ip-masq-agent/ip-masq-agent_test.go:36:10: Error return value of `flag.Set` is not checked (errcheck)
    flag.Set("masq-chain", "IP-MASQ-AGENT")
            ^
cmd/ip-masq-agent/ip-masq-agent_test.go:255:11: Error return value of `flag.Set` is not checked (errcheck)
        flag.Set("enable-ipv6", "true")
                ^
cmd/ip-masq-agent/ip-masq-agent_test.go:354:19: Error return value of `m.syncMasqRules` is not checked (errcheck)
            m.syncMasqRules()
                           ^
cmd/ip-masq-agent/ip-masq-agent_test.go:360:17: Error return value of `fipt.SaveInto` is not checked (errcheck)
            fipt.SaveInto("nat", buf)
                         ^
cmd/ip-masq-agent/ip-masq-agent_test.go:428:23: Error return value of `m.syncMasqRulesIPv6` is not checked (errcheck)
            m.syncMasqRulesIPv6()
                               ^
cmd/ip-masq-agent/ip-masq-agent_test.go:434:18: Error return value of `fipt6.SaveInto` is not checked (errcheck)
            fipt6.SaveInto("nat", buf)
                          ^
cmd/ip-masq-agent/ip-masq-agent_test.go:361:7: S1030: should use buf.String() instead of string(buf.Bytes()) (gosimple)
            if string(buf.Bytes()) != string(tt.want) {
               ^
cmd/ip-masq-agent/ip-masq-agent_test.go:362:49: S1030: should use buf.String() instead of string(buf.Bytes()) (gosimple)
                t.Errorf("syncMasqRules wrote %q, want %q", string(buf.Bytes()), tt.want)
                                                            ^
cmd/ip-masq-agent/ip-masq-agent_test.go:435:7: S1030: should use buf.String() instead of string(buf.Bytes()) (gosimple)
            if string(buf.Bytes()) != tt.want {
               ^
cmd/ip-masq-agent/testing/fakefs/fakefs.go:21:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
    "io/ioutil"
    ^

make: *** [Makefile:372: lint] Error 1
jingyuanliang commented 1 year ago

@Ramkumar-K interested in cleaning this up? a lot of them are in the tests.

Ramkumar-K commented 1 year ago

Sure. I can take this on.

k8s-triage-robot commented 9 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

jingyuanliang commented 9 months ago

/remove-lifecycle stale

jingyuanliang commented 8 months ago

https://github.com/kubernetes-sigs/ip-masq-agent/pull/127