diff --git a/.golangci.yml b/.golangci.yml index 237b523e66..f72b12739b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,7 +21,6 @@ linters: # useful hints that should be addressed - ginkgolinter - nakedret - - mirror - wastedassign - gosmopolitan # usage of time.Local in pkg/k8s.io - tagliatelle # too many JSON keys cannot be changed due to compat diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go index 7f89c4ac63..2e89cff56d 100644 --- a/cmd/podman/system/connection/add.go +++ b/cmd/podman/system/connection/add.go @@ -106,7 +106,7 @@ func add(cmd *cobra.Command, args []string) error { Default: cOpts.Default, } dest := args[1] - if match, err := regexp.Match("^[A-Za-z][A-Za-z0-9+.-]*://", []byte(dest)); err != nil { + if match, err := regexp.MatchString("^[A-Za-z][A-Za-z0-9+.-]*://", dest); err != nil { return fmt.Errorf("invalid destination: %w", err) } else if !match { dest = "ssh://" + dest @@ -203,7 +203,7 @@ func create(cmd *cobra.Command, args []string) error { if err != nil { return err } - if match, err := regexp.Match("^[A-Za-z][A-Za-z0-9+.-]*://", []byte(dest)); err != nil { + if match, err := regexp.MatchString("^[A-Za-z][A-Za-z0-9+.-]*://", dest); err != nil { return fmt.Errorf("invalid destination: %w", err) } else if !match { dest = "ssh://" + dest diff --git a/cmd/quadlet/main.go b/cmd/quadlet/main.go index 21544b15a4..7549886eae 100644 --- a/cmd/quadlet/main.go +++ b/cmd/quadlet/main.go @@ -64,7 +64,7 @@ func logToKmsg(s string) bool { kmsgFile = f } - if _, err := kmsgFile.Write([]byte(s)); err != nil { + if _, err := kmsgFile.WriteString(s); err != nil { kmsgFile.Close() kmsgFile = nil return false diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go index 2393ff9204..38fd07bdea 100644 --- a/libpod/oci_conmon_common.go +++ b/libpod/oci_conmon_common.go @@ -343,7 +343,7 @@ func generateResourceFile(res *spec.LinuxResources) (string, []string, error) { if err != nil { return "", nil, err } - _, err = f.WriteString(string(j)) + _, err = f.Write(j) if err != nil { return "", nil, err } diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go index 323daec723..76d7b982a5 100644 --- a/pkg/rootless/rootless_linux.go +++ b/pkg/rootless/rootless_linux.go @@ -374,7 +374,7 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo } } - _, err = w.Write([]byte("0")) + _, err = w.WriteString("0") if err != nil { return false, -1, fmt.Errorf("write to sync pipe: %w", err) } diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 7d4077a2fc..4b9c2f7faa 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -1739,7 +1739,7 @@ func createSourceTarFile(fileName, fileContent, tarFilePath string) error { return err } - _, err = file.Write([]byte(fileContent)) + _, err = file.WriteString(fileContent) if err != nil { return err } @@ -4996,7 +4996,7 @@ spec: file, err := os.Create(filepath.Join(hostPathLocation, "testing", "onlythis", "123.txt")) Expect(err).ToNot(HaveOccurred()) - _, err = file.Write([]byte("hi")) + _, err = file.WriteString("hi") Expect(err).ToNot(HaveOccurred()) err = file.Close() diff --git a/utils/utils_supported.go b/utils/utils_supported.go index 418c1f871a..ecd0c4c024 100644 --- a/utils/utils_supported.go +++ b/utils/utils_supported.go @@ -175,7 +175,7 @@ func moveUnderCgroup(cgroup, subtree string, processes []uint32) error { if len(processes) > 0 { for _, pid := range processes { - if _, err := f.Write([]byte(fmt.Sprintf("%d\n", pid))); err != nil { + if _, err := f.WriteString(fmt.Sprintf("%d\n", pid)); err != nil { logrus.Debugf("Cannot move process %d to cgroup %q: %v", pid, newCgroup, err) } }