enable gocritic linter

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2023-03-12 10:24:30 +01:00
parent 5a7619c019
commit 79f524689c
13 changed files with 39 additions and 33 deletions

View File

@ -334,7 +334,7 @@ func cmdAdd(args *skel.CmdArgs) error {
err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
for key, value := range tuningConf.SysCtl {
key = strings.Replace(key, ".", string(os.PathSeparator), -1)
key = strings.ReplaceAll(key, ".", string(os.PathSeparator))
// If the key contains `IFNAME` - substitute it with args.IfName
// to allow setting sysctls on a particular interface, on which
@ -439,7 +439,7 @@ func cmdCheck(args *skel.CmdArgs) error {
err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
// Check each configured value vs what's currently in the container
for key, confValue := range tuningConf.SysCtl {
fileName := filepath.Join("/proc/sys", strings.Replace(key, ".", "/", -1))
fileName := filepath.Join("/proc/sys", strings.ReplaceAll(key, ".", "/"))
contents, err := os.ReadFile(fileName)
if err != nil {