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

cgroups: golangci-lint fixes. #428

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 3 deletions pkg/cgroups/cgroupblkio.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package cgroups
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -341,7 +340,7 @@ var currentPlatform platformInterface = defaultPlatform{}

// readFromFile returns file contents as a string.
func (dpm defaultPlatform) readFromFile(filename string) (string, error) {
content, err := ioutil.ReadFile(filename)
content, err := os.ReadFile(filename)
return string(content), err
}

Expand All @@ -352,6 +351,6 @@ func (dpm defaultPlatform) writeToFile(filename string, content string) error {
return err
}
defer f.Close()
_, err = fmt.Fprintf(f, content)
_, err = fmt.Fprintf(f, "%s", content)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. Hopefully we were never writing % characters into cgroup files....

fmt.Fprintf(os.Stdout, "42%")
-> 42%!(NOVERB)

return err
}
4 changes: 2 additions & 2 deletions pkg/cgroups/cgroupstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package cgroups

import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -89,7 +89,7 @@ type GlobalNumaStats struct {

func readCgroupFileLines(filePath string) ([]string, error) {

f, err := ioutil.ReadFile(filePath)
f, err := os.ReadFile(filePath)

if err != nil {
return nil, err
Expand Down
Loading