Skip to content

Commit 2f5fe97

Browse files
build(deps): bump github.com/alexkohler/prealloc from 1.0.0 to 1.0.1 (#6289)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 246bc08 commit 2f5fe97

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/alecthomas/chroma/v2 v2.21.1
2222
github.com/alecthomas/go-check-sumtype v0.3.1
2323
github.com/alexkohler/nakedret/v2 v2.0.6
24-
github.com/alexkohler/prealloc v1.0.0
24+
github.com/alexkohler/prealloc v1.0.1
2525
github.com/alingse/asasalint v0.0.11
2626
github.com/alingse/nilnesserr v0.2.0
2727
github.com/ashanbrown/forbidigo/v2 v2.3.0

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/prealloc/prealloc.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package prealloc
22

33
import (
4-
"fmt"
5-
64
"github.com/alexkohler/prealloc/pkg"
75
"golang.org/x/tools/go/analysis"
86

97
"github.com/golangci/golangci-lint/v2/pkg/config"
108
"github.com/golangci/golangci-lint/v2/pkg/goanalysis"
11-
"github.com/golangci/golangci-lint/v2/pkg/golinters/internal"
129
)
1310

1411
func New(settings *config.PreallocSettings) *goanalysis.Linter {
@@ -29,9 +26,6 @@ func runPreAlloc(pass *analysis.Pass, settings *config.PreallocSettings) {
2926
hints := pkg.Check(pass.Files, settings.Simple, settings.RangeLoops, settings.ForLoops)
3027

3128
for _, hint := range hints {
32-
pass.Report(analysis.Diagnostic{
33-
Pos: hint.Pos,
34-
Message: fmt.Sprintf("Consider pre-allocating %s", internal.FormatCode(hint.DeclaredSliceName)),
35-
})
29+
pass.Report(hint)
3630
}
3731
}

pkg/golinters/prealloc/testdata/prealloc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package testdata
33

44
func Prealloc(source []int) []int {
5-
var dest []int // want "Consider pre-allocating `dest`"
5+
var dest []int // want `Consider preallocating dest with capacity len\(source\)`
66
for _, v := range source {
77
dest = append(dest, v)
88
}

pkg/golinters/prealloc/testdata/prealloc_cgo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func _() {
2222
}
2323

2424
func _(source []int) []int {
25-
var dest []int // want "Consider pre-allocating `dest`"
25+
var dest []int // want `Consider preallocating dest with capacity len\(source\)`
2626
for _, v := range source {
2727
dest = append(dest, v)
2828
}

0 commit comments

Comments
 (0)