Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace deprecation ioutil fucntions and add depguard rules in .golangci.yml #3808

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
3 changes: 1 addition & 2 deletions pkg/metriccollect/local/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package local

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -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
}
Expand Down
Loading