Applied perfsprint linter

- concatenate simple sprint calls
- use errors.New when possible
- use strconv for "%d" or "%x" sprint calls
This commit is contained in:
Olivier Meunier
2025-02-19 08:35:30 +01:00
parent 4ca9b45751
commit 2630ee1678
36 changed files with 63 additions and 66 deletions

View File

@@ -20,6 +20,7 @@ import (
"os"
"path"
"path/filepath"
"strconv"
"strings"
figure "github.com/mangoumbrella/goldmark-figure"
@@ -199,7 +200,7 @@ func getEtag(name string, src ...io.Reader) string {
if err != nil {
log.Fatal(err)
}
return fmt.Sprintf("%x", h.Sum64())
return strconv.FormatUint(h.Sum64(), 16)
}
func newManifest(fileList []*File) (*Manifest, error) {

View File

@@ -224,7 +224,7 @@ var lineRE = regexp.MustCompile(`^(.+?)(?:\((.+)\))?:\s*(.*)$`)
func parseLine(line string) ([3]string, error) {
if !lineRE.MatchString(line) {
return [3]string{}, fmt.Errorf("Cannot parse line")
return [3]string{}, errors.New("Cannot parse line")
}
m := lineRE.FindAllStringSubmatch(line, -1)