Skip to content

Commit 93c54d3

Browse files
authored
fix: invalid type for pool reset (#37)
* chore: add .gitignore * tests: add a falling test * fix: invalid type for pool reset * chore: ignore
1 parent af8760d commit 93c54d3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/goconst

api.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ func PutIssueBuffer(issues []Issue) {
4141
issues[i].Str = ""
4242
}
4343
// Return the slice to the pool
44-
issuesCopy := make([]Issue, 0, cap(issues))
45-
IssuePool.Put(&issuesCopy)
44+
IssuePool.Put(make([]Issue, 0, cap(issues))) //nolint:staticcheck
4645
}
4746

4847
// Config contains all configuration options for the goconst analyzer.

api_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,3 +562,8 @@ func checker(fset *token.FileSet) (*types.Checker, *types.Info) {
562562
}
563563
return types.NewChecker(cfg, fset, types.NewPackage("", "example"), info), info
564564
}
565+
566+
func Test_IssuePool(t *testing.T) {
567+
PutIssueBuffer([]Issue{})
568+
GetIssueBuffer()
569+
}

0 commit comments

Comments
 (0)