diff --git a/.golangci.yml b/.golangci.yml index ff6278c1cc..275d7ebaed 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -46,15 +46,14 @@ linters: - goimports - govet # linters default enabled by golangci-lint . - - deadcode - depguard #- errcheck - gosimple - ineffassign - staticcheck - typecheck + # deadcode and varcheck is deprecated (since v1.49.0). Replaced by unused. - unused - - varcheck # other linters supported by golangci-lint. #- gosec #- revive @@ -74,3 +73,5 @@ linters-settings: deny: - pkg: "k8s.io/klog$" desc: "k8s.io/klog is deprecated, use k8s.io/klog/v2 instead" + - pkg: "io/ioutil" + desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil" diff --git a/pkg/metriccollect/local/memory.go b/pkg/metriccollect/local/memory.go index 95a37ccdb2..62f785592d 100644 --- a/pkg/metriccollect/local/memory.go +++ b/pkg/metriccollect/local/memory.go @@ -18,7 +18,6 @@ package local import ( "fmt" - "io/ioutil" "os" "path/filepath" "strconv" @@ -91,7 +90,7 @@ func (c *MemoryResourceCollector) CollectLocalMetrics(metricInfo *LocalMetricInf func getMemoryUsage(cgroupRoot string) (int64, error) { usage := int64(0) cgroupMemory := filepath.Join(cgroupRoot, cgroup.MemoryUsageFile) - date, err := ioutil.ReadFile(cgroupMemory) + date, err := os.ReadFile(cgroupMemory) if err != nil { return 0, err }