Skip to content

Commit b7efe33

Browse files
authored
INS-1938: Upgrade goldilocks with go 1.26 (#831)
* Fix * Fix * Go fix * Go fix * Revert "Go fix" This reverts commit a32a9af. * Fix * Revert "Fix" This reverts commit ce9ceea.
1 parent 4108c88 commit b7efe33

File tree

11 files changed

+128
-133
lines changed

11 files changed

+128
-133
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
test:
3636
working_directory: /home/circleci/go/src/github.com/fairwindsops/goldilocks
3737
docker:
38-
- image: cimg/go:1.25.5
38+
- image: cimg/go:1.26.0
3939
environment:
4040
GL_DEBUG: linters_output
4141
GOPACKAGESPRINTGOLISTERRORS: "1"
@@ -44,8 +44,8 @@ jobs:
4444
- run:
4545
name: golangci-lint
4646
environment:
47-
GOLANGCI_LINT_VERSION: 2.5.0
48-
GOLANGCI_LINT_CHECKSUM: c77313a77e19b06123962c411d9943cc0d092bbec76b956104d18964e274902e
47+
GOLANGCI_LINT_VERSION: 2.10.1
48+
GOLANGCI_LINT_CHECKSUM: dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99
4949
command: |
5050
curl -OL https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz
5151
[[ "$(sha256sum golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz)" == "${GOLANGCI_LINT_CHECKSUM} golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" ]]
@@ -61,7 +61,7 @@ jobs:
6161
resource_class: large
6262
shell: /bin/bash
6363
docker:
64-
- image: goreleaser/goreleaser:v2.13.1
64+
- image: goreleaser/goreleaser:v2.14.0
6565
steps:
6666
- checkout
6767
- setup_remote_docker
@@ -78,7 +78,7 @@ jobs:
7878
working_directory: /go/src/github.com/fairwindsops/goldilocks
7979
resource_class: large
8080
docker:
81-
- image: goreleaser/goreleaser:v2.13.1
81+
- image: goreleaser/goreleaser:v2.14.0
8282
steps:
8383
- checkout
8484
- setup_remote_docker

go.mod

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

3-
go 1.25.5
3+
go 1.26.0
44

55
require (
66
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc

pkg/controller/controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func createController(kubeClient kubernetes.Interface, informer cache.SharedInde
170170
wq := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any](), resource)
171171

172172
_, err := informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
173-
AddFunc: func(obj interface{}) {
173+
AddFunc: func(obj any) {
174174
var evt utils.Event
175175
var err error
176176
evt.Key, err = cache.MetaNamespaceKeyFunc(obj)
@@ -184,7 +184,7 @@ func createController(kubeClient kubernetes.Interface, informer cache.SharedInde
184184
klog.V(2).Infof("%s/%s has been added.", resource, evt.Key)
185185
wq.Add(evt)
186186
},
187-
DeleteFunc: func(obj interface{}) {
187+
DeleteFunc: func(obj any) {
188188
var evt utils.Event
189189
var err error
190190
evt.Key, err = cache.MetaNamespaceKeyFunc(obj)
@@ -198,7 +198,7 @@ func createController(kubeClient kubernetes.Interface, informer cache.SharedInde
198198
klog.V(2).Infof("%s/%s has been deleted.", resource, evt.Key)
199199
wq.Add(evt)
200200
},
201-
UpdateFunc: func(old interface{}, new interface{}) {
201+
UpdateFunc: func(old any, new any) {
202202
var evt utils.Event
203203
var err error
204204
evt.Key, err = cache.MetaNamespaceKeyFunc(new)
@@ -225,7 +225,7 @@ func createController(kubeClient kubernetes.Interface, informer cache.SharedInde
225225
}
226226
}
227227

228-
func objectMeta(obj interface{}) metav1.ObjectMeta {
228+
func objectMeta(obj any) metav1.ObjectMeta {
229229
var meta metav1.ObjectMeta
230230

231231
switch object := obj.(type) {

pkg/controller/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
func Test_objectMeta(t *testing.T) {
2626
tests := []struct {
2727
name string
28-
obj interface{}
28+
obj any
2929
want metav1.ObjectMeta
3030
}{
3131
{

pkg/dashboard/helpers/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ func GetUUID() string {
147147
return uuid.New().String()
148148
}
149149

150-
func HasField(v interface{}, name string) bool {
150+
func HasField(v any, name string) bool {
151151
rv := reflect.ValueOf(v)
152-
if rv.Kind() == reflect.Ptr {
152+
if rv.Kind() == reflect.Pointer {
153153
rv = rv.Elem()
154154
}
155155
if rv.Kind() != reflect.Struct {

pkg/dashboard/templates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type baseTemplateData struct {
4242
BasePath string
4343

4444
// Data is the data struct passed to writeTemplate()
45-
Data interface{}
45+
Data any
4646

4747
// JSON is the json version of Data
4848
JSON template.JS
@@ -92,7 +92,7 @@ func parseTemplateFiles(tmpl *template.Template, includedTemplates []string) (*t
9292
}
9393

9494
// writeTemplate executes the given template with the data and writes to the writer.
95-
func writeTemplate(tmpl *template.Template, opts Options, data interface{}, w http.ResponseWriter) {
95+
func writeTemplate(tmpl *template.Template, opts Options, data any, w http.ResponseWriter) {
9696
buf := &bytes.Buffer{}
9797
jsonData, err := json.Marshal(data)
9898
if err != nil {

pkg/handler/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
// OnUpdate is a handler that should be called when an object is updated.
2727
// obj is the Kubernetes object that was updated.
2828
// event is the Event metadata representing the update.
29-
func OnUpdate(obj interface{}, event utils.Event) {
29+
func OnUpdate(obj any, event utils.Event) {
3030
klog.V(10).Infof("Handler got an OnUpdate event of type %s", event.EventType)
3131
if event.EventType == "delete" {
3232
onDelete(event)

pkg/summary/constants_test.go

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,24 @@ var testVPABasic = &vpav1.VerticalPodAutoscaler{
7575
}
7676

7777
var testDeploymentBasicUnstructured = &unstructured.Unstructured{
78-
Object: map[string]interface{}{
78+
Object: map[string]any{
7979
"kind": "Deployment",
8080
"apiVersion": "apps/v1",
81-
"metadata": map[string]interface{}{
81+
"metadata": map[string]any{
8282
"name": "test-basic",
8383
"namespace": "testing",
8484
},
85-
"spec": map[string]interface{}{},
85+
"spec": map[string]any{},
8686
},
8787
}
8888

8989
var testDeploymentBasicReplicaSetUnstructured = &unstructured.Unstructured{
90-
Object: map[string]interface{}{
90+
Object: map[string]any{
9191
"kind": "ReplicaSet",
9292
"apiVersion": "apps/v1",
93-
"metadata": map[string]interface{}{
94-
"ownerReferences": []interface{}{
95-
map[string]interface{}{
93+
"metadata": map[string]any{
94+
"ownerReferences": []any{
95+
map[string]any{
9696
"apiVersion": "apps/v1",
9797
"kind": "Deployment",
9898
"controller": true,
@@ -102,17 +102,17 @@ var testDeploymentBasicReplicaSetUnstructured = &unstructured.Unstructured{
102102
"name": "test-basic-0123456789",
103103
"namespace": "testing",
104104
},
105-
"spec": map[string]interface{}{},
105+
"spec": map[string]any{},
106106
},
107107
}
108108

109109
var testDeploymentBasicPodUnstructured = &unstructured.Unstructured{
110-
Object: map[string]interface{}{
110+
Object: map[string]any{
111111
"kind": "Pod",
112112
"apiVersion": "v1",
113-
"metadata": map[string]interface{}{
114-
"ownerReferences": []interface{}{
115-
map[string]interface{}{
113+
"metadata": map[string]any{
114+
"ownerReferences": []any{
115+
map[string]any{
116116
"apiVersion": "apps/v1",
117117
"kind": "ReplicaSet",
118118
"controller": true,
@@ -122,7 +122,7 @@ var testDeploymentBasicPodUnstructured = &unstructured.Unstructured{
122122
"name": "test-basic-0123456789-01234",
123123
"namespace": "testing",
124124
},
125-
"spec": map[string]interface{}{},
125+
"spec": map[string]any{},
126126
},
127127
}
128128

@@ -178,25 +178,25 @@ var testVPAWithReco = &vpav1.VerticalPodAutoscaler{
178178
}
179179

180180
var testDeploymentWithRecoUnstructured = &unstructured.Unstructured{
181-
Object: map[string]interface{}{
181+
Object: map[string]any{
182182
"kind": "Deployment",
183183
"apiVersion": "apps/v1",
184-
"metadata": map[string]interface{}{
184+
"metadata": map[string]any{
185185
"name": "test-vpa-with-reco",
186186
"namespace": "testing",
187187
},
188-
"spec": map[string]interface{}{
189-
"template": map[string]interface{}{
190-
"spec": map[string]interface{}{
191-
"containers": []interface{}{
192-
map[string]interface{}{
188+
"spec": map[string]any{
189+
"template": map[string]any{
190+
"spec": map[string]any{
191+
"containers": []any{
192+
map[string]any{
193193
"name": "container",
194-
"resources": map[string]interface{}{
195-
"limits": map[string]interface{}{
194+
"resources": map[string]any{
195+
"limits": map[string]any{
196196
"cpu": "100m",
197197
"memory": "100Mi",
198198
},
199-
"requests": map[string]interface{}{
199+
"requests": map[string]any{
200200
"cpu": "100m",
201201
"memory": "100Mi",
202202
},
@@ -210,12 +210,12 @@ var testDeploymentWithRecoUnstructured = &unstructured.Unstructured{
210210
}
211211

212212
var testDeploymentWithRecoReplicaSetUnstructured = &unstructured.Unstructured{
213-
Object: map[string]interface{}{
213+
Object: map[string]any{
214214
"kind": "ReplicaSet",
215215
"apiVersion": "apps/v1",
216-
"metadata": map[string]interface{}{
217-
"ownerReferences": []interface{}{
218-
map[string]interface{}{
216+
"metadata": map[string]any{
217+
"ownerReferences": []any{
218+
map[string]any{
219219
"apiVersion": "apps/v1",
220220
"kind": "Deployment",
221221
"controller": true,
@@ -225,17 +225,17 @@ var testDeploymentWithRecoReplicaSetUnstructured = &unstructured.Unstructured{
225225
"name": "test-vpa-with-reco-0123456789",
226226
"namespace": "testing",
227227
},
228-
"spec": map[string]interface{}{},
228+
"spec": map[string]any{},
229229
},
230230
}
231231

232232
var testDeploymentWithRecoPodUnstructured = &unstructured.Unstructured{
233-
Object: map[string]interface{}{
233+
Object: map[string]any{
234234
"kind": "Pod",
235235
"apiVersion": "v1",
236-
"metadata": map[string]interface{}{
237-
"ownerReferences": []interface{}{
238-
map[string]interface{}{
236+
"metadata": map[string]any{
237+
"ownerReferences": []any{
238+
map[string]any{
239239
"apiVersion": "apps/v1",
240240
"kind": "ReplicaSet",
241241
"controller": true,
@@ -245,7 +245,7 @@ var testDeploymentWithRecoPodUnstructured = &unstructured.Unstructured{
245245
"name": "test-vpa-with-reco-0123456789-01234",
246246
"namespace": "testing",
247247
},
248-
"spec": map[string]interface{}{},
248+
"spec": map[string]any{},
249249
},
250250
}
251251

@@ -254,7 +254,7 @@ var testDeploymentWithRecoPodUnstructured = &unstructured.Unstructured{
254254
var testSummary = Summary{
255255
Namespaces: map[string]namespaceSummary{
256256
"testing": {
257-
Namespace: "testing",
257+
Namespace: "testing",
258258
IsOnlyNamespace: true,
259259
Workloads: map[string]workloadSummary{
260260
"test-basic": {
@@ -284,25 +284,25 @@ var testSummary = Summary{
284284
// DaemonSet test and VPA
285285

286286
var testDaemonSettWithRecoUnstructured = &unstructured.Unstructured{
287-
Object: map[string]interface{}{
287+
Object: map[string]any{
288288
"kind": "DaemonSet",
289289
"apiVersion": "apps/v1",
290-
"metadata": map[string]interface{}{
290+
"metadata": map[string]any{
291291
"name": "test-ds-with-reco",
292292
"namespace": "testing-daemonset",
293293
},
294-
"spec": map[string]interface{}{
295-
"template": map[string]interface{}{
296-
"spec": map[string]interface{}{
297-
"containers": []interface{}{
298-
map[string]interface{}{
294+
"spec": map[string]any{
295+
"template": map[string]any{
296+
"spec": map[string]any{
297+
"containers": []any{
298+
map[string]any{
299299
"name": "container",
300-
"resources": map[string]interface{}{
301-
"limits": map[string]interface{}{
300+
"resources": map[string]any{
301+
"limits": map[string]any{
302302
"cpu": "100m",
303303
"memory": "100Mi",
304304
},
305-
"requests": map[string]interface{}{
305+
"requests": map[string]any{
306306
"cpu": "100m",
307307
"memory": "100Mi",
308308
},
@@ -316,12 +316,12 @@ var testDaemonSettWithRecoUnstructured = &unstructured.Unstructured{
316316
}
317317

318318
var testDaemonSetWithRecoPodUnstructured = &unstructured.Unstructured{
319-
Object: map[string]interface{}{
319+
Object: map[string]any{
320320
"kind": "Pod",
321321
"apiVersion": "v1",
322-
"metadata": map[string]interface{}{
323-
"ownerReferences": []interface{}{
324-
map[string]interface{}{
322+
"metadata": map[string]any{
323+
"ownerReferences": []any{
324+
map[string]any{
325325
"apiVersion": "apps/v1",
326326
"kind": "DaemonSet",
327327
"controller": true,
@@ -331,7 +331,7 @@ var testDaemonSetWithRecoPodUnstructured = &unstructured.Unstructured{
331331
"name": "test-ds-with-reco-01234",
332332
"namespace": "testing-daemonset",
333333
},
334-
"spec": map[string]interface{}{},
334+
"spec": map[string]any{},
335335
},
336336
}
337337

@@ -370,7 +370,7 @@ var testDaemonSetVPAWithReco = &vpav1.VerticalPodAutoscaler{
370370
var testSummaryDaemonSet = Summary{
371371
Namespaces: map[string]namespaceSummary{
372372
"testing-daemonset": {
373-
Namespace: "testing-daemonset",
373+
Namespace: "testing-daemonset",
374374
IsOnlyNamespace: true,
375375
Workloads: map[string]workloadSummary{
376376
"test-ds-with-reco": {

0 commit comments

Comments
 (0)