Skip to content

Commit 86a2ef9

Browse files
committed
chore: update go, linter, fix linter errors
1 parent 95cb6e1 commit 86a2ef9

File tree

10 files changed

+21
-19
lines changed

10 files changed

+21
-19
lines changed

.github/workflows/agent-ci.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ on:
3535
env:
3636
REGISTRY: ghcr.io
3737
IMAGE_NAME: ${{ github.repository }}
38+
GO_VERSION: 1.26.0
3839
PYTHON_VERSION: 3.13
3940
DEBIAN_VERSION: trixie
4041
jobs:
@@ -266,10 +267,10 @@ jobs:
266267
fetch-tags: true
267268
fetch-depth: 0
268269

269-
- name: Set up Go
270+
- name: Set up Go ${{ env.GO_VERSION }}
270271
uses: actions/setup-go@v5
271272
with:
272-
go-version: '1.25.6'
273+
go-version: ${{ env.GO_VERSION }}
273274
cache-dependency-path: operator/go.sum
274275

275276
- name: Log in to the Container registry
@@ -291,8 +292,8 @@ jobs:
291292
id: cached-binaries
292293
uses: actions/cache/restore@v4
293294
with:
294-
key: 1.25.6-${{ runner.os }}-${{ runner.arch }}-bin-${{ hashFiles('operator/deps.mk') }}
295-
restore-keys: 1.25.6-${{ runner.os }}-${{ runner.arch }}-bin-
295+
key: ${{ env.GO_VERSION }}-${{ runner.os }}-${{ runner.arch }}-bin-${{ hashFiles('operator/deps.mk') }}
296+
restore-keys: ${{ env.GO_VERSION }}-${{ runner.os }}-${{ runner.arch }}-bin-
296297
path: |
297298
${{ github.workspace }}/operator/bin
298299
~/.cache/go-build
@@ -307,7 +308,7 @@ jobs:
307308
if: steps.cached-binaries.outputs.cache-hit != 'true'
308309
uses: actions/cache/save@v4
309310
with:
310-
key: 1.25.6-${{ runner.os }}-${{ runner.arch }}-bin-${{ hashFiles('operator/deps.mk') }}
311+
key: ${{ env.GO_VERSION }}-${{ runner.os }}-${{ runner.arch }}-bin-${{ hashFiles('operator/deps.mk') }}
311312
path: |
312313
${{ github.workspace }}/operator/bin
313314
~/.cache/go-build

.github/workflows/cli-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
- cli/*
2424

2525
env:
26-
GO_VERSION: 1.25.6
26+
GO_VERSION: 1.26.0
2727

2828
jobs:
2929
release:

.github/workflows/operator-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ on:
4141
env:
4242
REGISTRY: ghcr.io
4343
IMAGE_NAME: ${{ github.repository }}
44-
GO_VERSION: 1.25.6
44+
GO_VERSION: 1.26.0
4545
DEBIAN_VERSION: trixie
4646
PLATFORMS: linux/amd64,linux/arm64
4747

operator/.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ linters:
6161
path: api/*
6262
- linters:
6363
- dupl
64+
- prealloc
6465
path: _test\.go
6566
- linters:
6667
- dupl

operator/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ include deps.mk
1616

1717
## Version of the operator
1818
VERSION ?= $(GIT_TAG_LAST)
19-
GO_VERSION ?= 1.25.6
19+
GO_VERSION ?= 1.26.0
2020
DEBIAN_VERSION ?= trixie
21-
DISTROLESS_VERSION ?= 4.0.1
21+
DISTROLESS_VERSION ?= 4.0.2
2222

2323
# Image URL to use all building/pushing image
2424
## TODO: update this to the correct image location

operator/deps.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ifndef ARCH
3636
endif
3737

3838
## versions
39-
GOLANGCI_LINT_VERSION ?= v2.7.2
39+
GOLANGCI_LINT_VERSION ?= v2.10.1
4040
KUSTOMIZE_VERSION ?= v5.4.1
4141
CONTROLLER_TOOLS_VERSION ?= v0.18.0
4242
ENVTEST_K8S_VERSION ?= 1.35.0

operator/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/NVIDIA/skyhook/operator
22

3-
go 1.25.6
3+
go 1.26.0
44

55
require (
66
github.com/go-logr/logr v1.4.3

operator/internal/controller/skyhook_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ func fudgeInterruptWithPriority(next []*v1alpha1.Package, configUpdates map[stri
13861386
}
13871387
}
13881388

1389-
packageNames := make([]string, 0)
1389+
packageNames := make([]string, 0, len(next))
13901390
for _, pkg := range next {
13911391
packageNames = append(packageNames, pkg.Name)
13921392
}

operator/internal/controller/webhook_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ func skyhookRules() []admissionregistrationv1.RuleWithOperations {
476476
func deploymentPolicyValidatingRules() []admissionregistrationv1.RuleWithOperations {
477477
mutrules := deploymentPolicyMutatingRules()
478478
oprs := mutrules[0].Operations
479-
newops := make([]admissionregistrationv1.OperationType, len(oprs))
479+
newops := make([]admissionregistrationv1.OperationType, 0, len(oprs)+1)
480480
copy(newops, oprs)
481481
newops = append(newops, admissionregistrationv1.Delete)
482482
mutrules[0].Operations = newops

operator/internal/graph/dependency_graph.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (d *dag[T]) Add(name string, object T, dependencies ...string) error {
109109

110110
// leaves handle edge cases where there are more then one leaf, and from is a subset of the leaves not in the from
111111
func (d *dag[T]) leaves(from []string) []string {
112-
leaves := make([]string, 0)
112+
leaves := make([]string, 0, len(d.leafs))
113113
for _, f := range d.leafs {
114114
leaves = append(leaves, f.name)
115115
}
@@ -122,7 +122,7 @@ func (d *dag[T]) leaves(from []string) []string {
122122

123123
// diff returns the elements in a that are not in b
124124
func diff(a, b []string) []string {
125-
ret := make([]string, 0)
125+
ret := make([]string, 0, len(a))
126126
for _, v := range a {
127127
if !slices.Contains(b, v) {
128128
ret = append(ret, v)
@@ -179,7 +179,7 @@ func (d *dag[T]) Next(from ...string) ([]string, error) {
179179
}
180180

181181
func (d *dag[T]) Get(from ...string) []T {
182-
ret := make([]T, 0)
182+
ret := make([]T, 0, len(from))
183183
for _, f := range from {
184184
ret = append(ret, d.vertices[f].object)
185185
}
@@ -188,7 +188,7 @@ func (d *dag[T]) Get(from ...string) []T {
188188

189189
func (d *dag[T]) Valid() error {
190190
if len(d.placeholders) > 0 {
191-
miss := make([]string, 0)
191+
miss := make([]string, 0, len(d.placeholders))
192192
for k := range d.placeholders {
193193
miss = append(miss, k)
194194
}
@@ -198,7 +198,7 @@ func (d *dag[T]) Valid() error {
198198
}
199199

200200
func flat[T any](m map[string]*vertex[T]) []*vertex[T] {
201-
root := make([]*vertex[T], 0)
201+
root := make([]*vertex[T], 0, len(m))
202202
for _, val := range m {
203203
root = append(root, val)
204204
}
@@ -214,7 +214,7 @@ func sortEdges[T any](e []*vertex[T]) {
214214
}
215215

216216
func getNames[T any](vs []*vertex[T]) []string {
217-
ret := make([]string, 0)
217+
ret := make([]string, 0, len(vs))
218218
for _, v := range vs {
219219
ret = append(ret, v.name)
220220
}

0 commit comments

Comments
 (0)