Skip to content

Commit

Permalink
chore: fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
maypok86 committed Nov 22, 2024
1 parent ba15df1 commit 50129ff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
version: v1.62
12 changes: 10 additions & 2 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ func (o *optimal) Ratio() float64 {
}
if uint64(data.Len()) >= o.capacity {
victim := heap.Pop(data)
delete(look, victim.(*optimalItem).key)
oi, ok := victim.(*optimalItem)
if !ok {
panic("can't cast victim")
}
delete(look, oi.key)
}
misses++
look[key] = struct{}{}
Expand All @@ -495,7 +499,11 @@ func (h optimalHeap) Less(i, j int) bool { return h[i].hits < h[j].hits }
func (h optimalHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }

func (h *optimalHeap) Push(x any) {
*h = append(*h, x.(*optimalItem))
oi, ok := x.(*optimalItem)
if !ok {
panic("can't cast x")
}
*h = append(*h, oi)
}

func (h *optimalHeap) Pop() any {
Expand Down
1 change: 1 addition & 0 deletions cmd/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (g *generator) printStructComment() {
i := 2
for _, f := range declaredFeatures {
if g.features[f] {
//nolint:staticcheck // used only for unicode
featureTitle := strings.Title(strings.ToLower(f.name))
g.p("//")
g.p("// %d. %s", i, featureTitle)
Expand Down
3 changes: 1 addition & 2 deletions scripts/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
set -e

(which golangci-lint > /dev/null) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |
bash -s -- -b "$(go env GOPATH)"/bin v1.60.3
bash -s -- -b "$(go env GOPATH)"/bin v1.62.0

go install github.com/daixiang0/gci@latest
GO111MODULE=on go install mvdan.cc/gofumpt@latest
go install github.com/golang/mock/mockgen@latest

0 comments on commit 50129ff

Please # to comment.