Skip to content

Commit 49d5810

Browse files
committed
chore: go fix for 1.26
1 parent 0cc5acb commit 49d5810

9 files changed

Lines changed: 17 additions & 15 deletions

File tree

.toolbox.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ TB_MOCKGEN ?= $(TB_LOCALBIN)/mockgen
2020
TB_SEMVER ?= $(TB_LOCALBIN)/semver
2121

2222
## Tool Versions
23-
TB_GOLANGCI_LINT_VERSION ?= v2.9.0
23+
TB_GOLANGCI_LINT_VERSION ?= v2.10.1
2424
TB_GOLANGCI_LINT_VERSION_NUM ?= $(call STRIP_V,$(TB_GOLANGCI_LINT_VERSION))
25-
TB_GORELEASER_VERSION ?= v2.13.3
25+
TB_GORELEASER_VERSION ?= v2.14.1
2626
TB_GORELEASER_VERSION_NUM ?= $(call STRIP_V,$(TB_GORELEASER_VERSION))
2727
TB_HELM_DOCS_VERSION ?= v1.14.2
2828
TB_MOCKGEN_VERSION ?= v0.6.0

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (m *Main) addToManager(r manager.Runnable) {
211211
}
212212

213213
// CustomConfigValue get a custom config value
214-
func (m *Main) CustomConfigValue(name string) interface{} {
214+
func (m *Main) CustomConfigValue(name string) any {
215215
if v, ok := m.Config.Custom[name]; ok {
216216
return v
217217
}

pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func findOwner(obj client.Object, namespace string, name string, cl client.Reade
130130
if ob, ok := obj.(metav1.Object); ok {
131131
for _, or := range ob.GetOwnerReferences() {
132132
var us runtime.Unstructured = &unstructured.Unstructured{
133-
Object: map[string]interface{}{
133+
Object: map[string]any{
134134
"kind": or.Kind,
135135
"apiVersion": or.APIVersion,
136136
},

pkg/config/config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ var _ = Describe("Config", func() {
170170
})
171171
mockReader.EXPECT().Get(ctx, gm.Any(), gm.AssignableToTypeOf(&unstructured.Unstructured{})).
172172
Do(func(ctx context.Context, key client.ObjectKey, us *unstructured.Unstructured, opts ...client.GetOption) error {
173-
us.Object["metadata"] = map[string]interface{}{
174-
"ownerReferences": []interface{}{
175-
map[string]interface{}{
173+
us.Object["metadata"] = map[string]any{
174+
"ownerReferences": []any{
175+
map[string]any{
176176
"kind": "Deployment",
177177
"name": "deployment-1",
178178
},
@@ -182,7 +182,7 @@ var _ = Describe("Config", func() {
182182
})
183183
mockReader.EXPECT().Get(ctx, gm.Any(), gm.AssignableToTypeOf(&unstructured.Unstructured{})).
184184
Do(func(ctx context.Context, key client.ObjectKey, us *unstructured.Unstructured, opts ...client.GetOption) error {
185-
us.Object["metadata"] = map[string]interface{}{
185+
us.Object["metadata"] = map[string]any{
186186
"name": "deployment-1",
187187
}
188188
us.Object["kind"] = "Deployment"

pkg/config/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ type Config struct {
3535
Metrics Metrics `json:"metrics"`
3636
HealthProbePort int `json:"healthProbePort"`
3737
// LatestMetricsLabel if true, each result metric is also created with executionID=latest
38-
LatestMetricsLabel bool `json:"latestMetricsLabel"`
39-
Custom map[string]interface{} `json:"custom"`
38+
LatestMetricsLabel bool `json:"latestMetricsLabel"`
39+
Custom map[string]any `json:"custom"`
4040
// CallbackServiceName if left blank, the pod IP is used for callback
4141
CallbackServiceName string `json:"callbackServiceName"`
4242
CallbackServicePort int `json:"callbackServicePort"`

pkg/http/postserver.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"net/http/pprof"
66
"os"
7+
"path/filepath"
78

89
"github.com/bakito/batch-job-controller/pkg/config"
910
"github.com/bakito/batch-job-controller/pkg/lifecycle"
@@ -118,7 +119,8 @@ func (s *PostServer) SaveFile(executionID, name string, data []byte) (string, er
118119
if err := s.Config.MkReportDir(executionID); err != nil {
119120
return "", err
120121
}
121-
fileName := s.Config.ReportFileName(executionID, name)
122+
fileName := filepath.Clean(s.Config.ReportFileName(executionID, name))
123+
// #nosec G703 -- fileName is sanitized by filepath.Clean and constructed from controlled inputs
122124
return fileName, os.WriteFile(fileName, data, 0o600)
123125
}
124126

pkg/http/postserver_load_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var _ = XDescribe("HTTP", func() {
9898
mockSink.EXPECT().Info(gm.Any(), "received 1 file").Times(loops)
9999

100100
var wg sync.WaitGroup
101-
for i := 0; i < loops; i++ {
101+
for i := range loops {
102102
wg.Add(1)
103103
time.Sleep(sleep)
104104
ii := i

pkg/http/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ type Event struct {
1515
Args []string `json:"args,omitempty"`
1616
}
1717

18-
func (e *Event) args() []interface{} {
19-
var args []interface{}
18+
func (e *Event) args() []any {
19+
var args []any
2020
for _, a := range e.Args {
2121
args = append(args, a)
2222
}

pkg/lifecycle/lifecycle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (c *controller) AllAdded(executionID string) error {
143143

144144
if len(files) > c.reportHistory {
145145
pruneCnt := len(files) - c.reportHistory
146-
for i := 0; i < pruneCnt; i++ {
146+
for i := range pruneCnt {
147147
name := files[i].Name()
148148
// delete the execution
149149
delete(c.executions, name)

0 commit comments

Comments
 (0)