Skip to content

Commit

Permalink
Merge pull request #3808 from dongjiang1989/drop-ioutil
Browse files Browse the repository at this point in the history
chore: Replace deprecation `ioutil` fucntions and add depguard rules in `.golangci.yml`
  • Loading branch information
volcano-sh-bot authored Nov 28, 2024
2 parents da761e2 + d048509 commit 7b037bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 7b037bb

Please sign in to comment.