Skip to content

Commit 051c6cc

Browse files
CopilotCharlieTLe
andcommitted
Fix lint failures: update CI for Go 1.24 and golangci-lint v1.64
- Update validate_pr.yml to use Go 1.24 matching go.mod requirement - Upgrade golangci-lint from v1.54 to v1.64 (supports Go 1.24) - Upgrade golangci-lint-action from v4 to v6 - Update .golangci.yml: use disable-all with explicit linter list, fix deprecated config options (output.format -> output.formats, errcheck.exclude -> removed) - Rename min/max functions in cmd/sim/main.go to avoid shadowing Go 1.21+ builtins (revive: redefines-builtin-id) - Rename 'new' parameter in CompareNamespaces to 'updated' to avoid shadowing builtin (revive: redefines-builtin-id) - Remove accidentally committed blockgen binary Co-authored-by: CharlieTLe <3375195+CharlieTLe@users.noreply.github.com>
1 parent 97f27bb commit 051c6cc

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

.github/workflows/validate_pr.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: actions/setup-go@v5
1414
with:
15-
go-version: 1.22
15+
go-version: '1.24'
1616
cache: false
1717
- name: golangci-lint
18-
uses: golangci/golangci-lint-action@v4
18+
uses: golangci/golangci-lint-action@v6
1919
with:
20-
version: v1.54
20+
version: v1.64
2121
unit_tests:
2222
name: Unit-Tests
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v4
2626
- uses: actions/setup-go@v5
2727
with:
28-
go-version: 1.22
28+
go-version: '1.24'
2929
- name: Unit Tests
3030
run: make test
3131
build:
@@ -35,6 +35,6 @@ jobs:
3535
- uses: actions/checkout@v4
3636
- uses: actions/setup-go@v5
3737
with:
38-
go-version: 1.22
38+
go-version: '1.24'
3939
- name: Build All
4040
run: make all

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ run:
66
- require_docker
77

88
output:
9-
format: line-number
9+
formats:
10+
- format: line-number
1011

1112
linters:
13+
disable-all: true
1214
enable:
1315
- goimports
1416
- revive
1517
- misspell
1618
- gofmt
1719

1820
linters-settings:
19-
errcheck:
20-
exclude: .errcheck-exclude
2121
goimports:
2222
local-prefixes: "github.com/cortexproject/cortex-tools"

blockgen

-74.8 MB
Binary file not shown.

cmd/sim/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ func run(k int, sizer func(float64) int) {
116116

117117
fmt.Printf("%d, %d, %d, %d, %f, %f\n",
118118
k,
119-
int(min(nodeSeries)),
120-
int(max(nodeSeries)),
119+
int(minFloat64(nodeSeries)),
120+
int(maxFloat64(nodeSeries)),
121121
int(stat.Mean(nodeSeries, nil)),
122122
stat.StdDev(nodeSeries, nil),
123123
float64(maxAffectedTenants)/float64(numTenants))
@@ -168,7 +168,7 @@ func shuffleShard(entropy *rand.Rand, shardSize, numReplicas int) []int {
168168
return ids
169169
}
170170

171-
func min(fs []float64) float64 {
171+
func minFloat64(fs []float64) float64 {
172172
result := math.MaxFloat64
173173
for _, f := range fs {
174174
if f < result {
@@ -178,7 +178,7 @@ func min(fs []float64) float64 {
178178
return result
179179
}
180180

181-
func max(fs []float64) float64 {
181+
func maxFloat64(fs []float64) float64 {
182182
result := 0.0
183183
for _, f := range fs {
184184
if f > result {

pkg/rules/compare.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ func rulesEqual(a, b *rulefmt.Rule) bool {
131131

132132
// CompareNamespaces returns the differences between the two provided
133133
// namespaces
134-
func CompareNamespaces(original, new RuleNamespace) NamespaceChange {
134+
func CompareNamespaces(original, updated RuleNamespace) NamespaceChange {
135135
result := NamespaceChange{
136-
Namespace: new.Namespace,
136+
Namespace: updated.Namespace,
137137
State: Unchanged,
138138
GroupsUpdated: []UpdatedRuleGroup{},
139139
GroupsCreated: []rwrulefmt.RuleGroup{},
@@ -145,7 +145,7 @@ func CompareNamespaces(original, new RuleNamespace) NamespaceChange {
145145
origMap[g.Name] = g
146146
}
147147

148-
for _, newGroup := range new.Groups {
148+
for _, newGroup := range updated.Groups {
149149
origGroup, found := origMap[newGroup.Name]
150150
if !found {
151151
result.State = Updated

0 commit comments

Comments
 (0)