mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
make lint: enable mirror
Helpful reports to avoid unnecessary allocations. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user