Skip to content

Commit

Permalink
perf: address perfsprint linter findings
Browse files Browse the repository at this point in the history
Enable the linter, but exclude fmt.Sprintf -> concatenation, as the
former is arguably often more readable.
  • Loading branch information
scop committed Mar 9, 2024
1 parent ac4bfa8 commit 74736d5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ linters-settings:
- name: unused-parameter
disabled: true

issues:
exclude:
# https://github.com/catenacyber/perfsprint/issues/21
# https://github.com/catenacyber/perfsprint/issues/23
- "^fmt\\.Sprintf can be replaced with string (addi|concatena)tion$"

linters:
disable-all: true
enable:
Expand Down Expand Up @@ -57,6 +63,7 @@ linters:
- nestif
- noctx
- nolintlint
- perfsprint
- predeclared
- reassign
- revive
Expand Down
4 changes: 2 additions & 2 deletions internal/lefthook/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bufio"
"crypto/md5"
"encoding/hex"
"fmt"
"errors"
"io"
"os"
"path/filepath"
Expand All @@ -31,7 +31,7 @@ const (
var (
lefthookChecksumRegexp = regexp.MustCompile(`(\w+)\s+(\d+)`)
configGlob = glob.MustCompile("{.,}lefthook.{yml,yaml,json,toml}")
errNoConfig = fmt.Errorf("no lefthook config found")
errNoConfig = errors.New("no lefthook config found")
)

// Install installs the hooks from config file to the .git/hooks.
Expand Down
4 changes: 2 additions & 2 deletions internal/log/skip_settings_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package log

import (
"fmt"
"strconv"
"testing"
)

Expand Down Expand Up @@ -85,7 +85,7 @@ func TestSkipSetting(t *testing.T) {
},
},
} {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
t.Run(strconv.Itoa(i), func(t *testing.T) {
var settings SkipSettings

(&settings).ApplySettings(tt.tags, tt.settings)
Expand Down

0 comments on commit 74736d5

Please sign in to comment.