Fix go-critic suggestions

This commit is contained in:
Oleg Kovalov
2022-08-17 19:37:58 +02:00
parent c172185a24
commit b08eac58e9
8 changed files with 13 additions and 13 deletions

View File

@@ -73,7 +73,7 @@ func IsExitError(err error) bool {
// if available.
func Expand(s string) (string, error) {
s = filepath.ToSlash(s)
s = strings.Replace(s, " ", `\ `, -1)
s = strings.ReplaceAll(s, " ", `\ `)
fields, err := shell.Fields(s, nil)
if err != nil {
return "", err

View File

@@ -45,8 +45,8 @@ func (c *Checksum) IsUpToDate() (bool, error) {
}
if !c.Dry {
_ = os.MkdirAll(filepathext.SmartJoin(c.TempDir, "checksum"), 0755)
if err = os.WriteFile(checksumFile, []byte(newMd5+"\n"), 0644); err != nil {
_ = os.MkdirAll(filepathext.SmartJoin(c.TempDir, "checksum"), 0o755)
if err = os.WriteFile(checksumFile, []byte(newMd5+"\n"), 0o644); err != nil {
return false, err
}
}

View File

@@ -19,11 +19,11 @@ func init() {
"OS": func() string { return runtime.GOOS },
"ARCH": func() string { return runtime.GOARCH },
"catLines": func(s string) string {
s = strings.Replace(s, "\r\n", " ", -1)
return strings.Replace(s, "\n", " ", -1)
s = strings.ReplaceAll(s, "\r\n", " ")
return strings.ReplaceAll(s, "\n", " ")
},
"splitLines": func(s string) []string {
s = strings.Replace(s, "\r\n", "\n", -1)
s = strings.ReplaceAll(s, "\r\n", "\n")
return strings.Split(s, "\n")
},
"fromSlash": func(path string) string {