Skip to content

Commit a5b1ca5

Browse files
committed
build(deps): update to go1.26
1 parent 34e9f8e commit a5b1ca5

32 files changed

+194
-220
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ lint: mod-tidy vet staticcheck golangci-lint modernize govulncheck
1919
lint-fix:
2020
go mod tidy
2121
golangci-lint run --fix
22-
go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -test -fix ./...
22+
go fix ./...
2323
$(MAKE) lint
2424

2525
mod-tidy:
@@ -35,7 +35,7 @@ staticcheck:
3535
go run honnef.co/go/tools/cmd/staticcheck@latest ./...
3636

3737
modernize:
38-
go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -test ./...
38+
go fix -diff ./... | awk '{print} /\S/ {found=1} END {if (found) exit 1}'
3939

4040
govulncheck:
4141
go run golang.org/x/vuln/cmd/govulncheck@latest ./...

api/gitinfo/auth.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
apps "github.com/ninech/apis/apps/v1alpha1"
77
corev1 "k8s.io/api/core/v1"
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
9-
"k8s.io/utils/ptr"
109
)
1110

1211
const (
@@ -95,14 +94,14 @@ func AuthSecretName(app *apps.Application) string {
9594
// UpdateFromSecret updates the Auth object with the data from the given secret.
9695
func (a *Auth) UpdateFromSecret(secret *corev1.Secret) {
9796
if val, ok := secret.Data[PrivateKeySecretKey]; ok {
98-
a.SSHPrivateKey = ptr.To(string(val))
97+
a.SSHPrivateKey = new(string(val))
9998
}
10099

101100
if val, ok := secret.Data[UsernameSecretKey]; ok {
102-
a.Username = ptr.To(string(val))
101+
a.Username = new(string(val))
103102
}
104103

105104
if val, ok := secret.Data[PasswordSecretKey]; ok {
106-
a.Password = ptr.To(string(val))
105+
a.Password = new(string(val))
107106
}
108107
}

api/gitinfo/client_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/ninech/nctl/internal/test"
1111
"github.com/stretchr/testify/require"
1212
"k8s.io/apimachinery/pkg/util/wait"
13-
"k8s.io/utils/ptr"
1413
)
1514

1615
func TestRepositoryInformation(t *testing.T) {
@@ -42,8 +41,8 @@ func TestRepositoryInformation(t *testing.T) {
4241
},
4342
token: "fake",
4443
auth: gitinfo.Auth{
45-
Username: ptr.To("fake"),
46-
Password: ptr.To("fakePass"),
44+
Username: new("fake"),
45+
Password: new("fakePass"),
4746
SSHPrivateKey: &dummyPrivateKey,
4847
},
4948
setResponse: &test.GitInformationServiceResponse{
@@ -99,7 +98,7 @@ func TestRepositoryInformation(t *testing.T) {
9998
},
10099
setResponse: &test.GitInformationServiceResponse{
101100
Code: http.StatusBadGateway,
102-
Raw: ptr.To("currently unavailable"),
101+
Raw: new("currently unavailable"),
103102
},
104103
errorExpected: true,
105104
},

auth/client_credentials.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"golang.org/x/oauth2/clientcredentials"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1"
14-
"k8s.io/utils/ptr"
1514

1615
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
1716
)
@@ -42,7 +41,7 @@ func (c *ClientCredentialsCmd) Run(ctx context.Context) error {
4241
},
4342
Status: &clientauthenticationv1.ExecCredentialStatus{
4443
Token: token.AccessToken,
45-
ExpirationTimestamp: ptr.To(metav1.NewTime(token.Expiry)),
44+
ExpirationTimestamp: new(metav1.NewTime(token.Expiry)),
4645
},
4746
}
4847
return json.NewEncoder(os.Stdout).Encode(execCredential)

create/application.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2828
"k8s.io/apimachinery/pkg/types"
2929
"k8s.io/apimachinery/pkg/watch"
30-
"k8s.io/utils/ptr"
3130
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"
3231
)
3332

@@ -301,7 +300,7 @@ func (cmd *applicationCmd) config() apps.Config {
301300
Command: cmd.DeployJob.Command,
302301
},
303302
FiniteJob: apps.FiniteJob{
304-
Retries: ptr.To(cmd.DeployJob.Retries),
303+
Retries: new(cmd.DeployJob.Retries),
305304
Timeout: &metav1.Duration{Duration: cmd.DeployJob.Timeout},
306305
},
307306
}
@@ -320,7 +319,7 @@ func (cmd *applicationCmd) config() apps.Config {
320319
},
321320
}
322321
if cmd.WorkerJob.Size != nil {
323-
workerJob.Size = ptr.To(apps.ApplicationSize(*cmd.WorkerJob.Size))
322+
workerJob.Size = new(apps.ApplicationSize(*cmd.WorkerJob.Size))
324323
}
325324
config.WorkerJobs = append(config.WorkerJobs, workerJob)
326325
}
@@ -339,7 +338,7 @@ func (cmd *applicationCmd) config() apps.Config {
339338
Schedule: cmd.ScheduledJob.Schedule,
340339
}
341340
if cmd.ScheduledJob.Size != nil {
342-
scheduledJob.Size = ptr.To(apps.ApplicationSize(*cmd.ScheduledJob.Size))
341+
scheduledJob.Size = new(apps.ApplicationSize(*cmd.ScheduledJob.Size))
343342
}
344343
config.ScheduledJobs = append(config.ScheduledJobs, scheduledJob)
345344
}

create/application_test.go

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
corev1 "k8s.io/api/core/v1"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626
"k8s.io/apimachinery/pkg/types"
27-
"k8s.io/utils/ptr"
2827
)
2928

3029
func createTempKeyFile(content string) (string, error) {
@@ -85,12 +84,12 @@ func TestCreateApplication(t *testing.T) {
8584
SubPath: "/my/app",
8685
Revision: "superbug",
8786
},
88-
Size: ptr.To("mini"),
87+
Size: new("mini"),
8988
Hosts: []string{"custom.example.org", "custom2.example.org"},
90-
Port: ptr.To(int32(1337)),
89+
Port: new(int32(1337)),
9190
HealthProbe: healthProbe{PeriodSeconds: int32(7), Path: "/he"},
92-
Replicas: ptr.To(int32(42)),
93-
BasicAuth: ptr.To(false),
91+
Replicas: new(int32(42)),
92+
BasicAuth: new(false),
9493
Env: map[string]string{"hello": "world"},
9594
BuildEnv: map[string]string{"BP_GO_TARGETS": "./cmd/web-server"},
9695
DeployJob: deployJob{Command: "date", Name: "print-date", Retries: 2, Timeout: time.Minute},
@@ -124,8 +123,8 @@ func TestCreateApplication(t *testing.T) {
124123
Wait: false,
125124
Name: "basic-auth",
126125
},
127-
Size: ptr.To("mini"),
128-
BasicAuth: ptr.To(true),
126+
Size: new("mini"),
127+
BasicAuth: new(true),
129128
SkipRepoAccessCheck: true,
130129
},
131130
checkApp: func(t *testing.T, cmd applicationCmd, app *apps.Application) {
@@ -139,8 +138,8 @@ func TestCreateApplication(t *testing.T) {
139138
cmd: applicationCmd{
140139
Git: gitConfig{
141140
URL: "https://github.com/ninech/doesnotexist.git",
142-
Username: ptr.To("deploy"),
143-
Password: ptr.To("hunter2"),
141+
Username: new("deploy"),
142+
Password: new("hunter2"),
144143
},
145144
resourceCmd: resourceCmd{
146145
Wait: false,
@@ -170,7 +169,7 @@ func TestCreateApplication(t *testing.T) {
170169
Wait: false,
171170
Name: "ssh-key-auth",
172171
},
173-
Size: ptr.To("mini"),
172+
Size: new("mini"),
174173
SkipRepoAccessCheck: true,
175174
},
176175
checkApp: func(t *testing.T, cmd applicationCmd, app *apps.Application) {
@@ -194,7 +193,7 @@ func TestCreateApplication(t *testing.T) {
194193
Wait: false,
195194
Name: "ssh-key-auth-ed25519",
196195
},
197-
Size: ptr.To("mini"),
196+
Size: new("mini"),
198197
SkipRepoAccessCheck: true,
199198
},
200199
checkApp: func(t *testing.T, cmd applicationCmd, app *apps.Application) {
@@ -212,13 +211,13 @@ func TestCreateApplication(t *testing.T) {
212211
cmd: applicationCmd{
213212
Git: gitConfig{
214213
URL: "https://github.com/ninech/doesnotexist.git",
215-
SSHPrivateKeyFromFile: ptr.To(filenameRSAKey),
214+
SSHPrivateKeyFromFile: new(filenameRSAKey),
216215
},
217216
resourceCmd: resourceCmd{
218217
Wait: false,
219218
Name: "ssh-key-auth-from-file",
220219
},
221-
Size: ptr.To("mini"),
220+
Size: new("mini"),
222221
SkipRepoAccessCheck: true,
223222
},
224223
checkApp: func(t *testing.T, cmd applicationCmd, app *apps.Application) {
@@ -236,13 +235,13 @@ func TestCreateApplication(t *testing.T) {
236235
cmd: applicationCmd{
237236
Git: gitConfig{
238237
URL: "https://github.com/ninech/doesnotexist.git",
239-
SSHPrivateKeyFromFile: ptr.To(filenameED25519Key),
238+
SSHPrivateKeyFromFile: new(filenameED25519Key),
240239
},
241240
resourceCmd: resourceCmd{
242241
Wait: false,
243242
Name: "ssh-key-auth-from-file-ed25519",
244243
},
245-
Size: ptr.To("mini"),
244+
Size: new("mini"),
246245
SkipRepoAccessCheck: true,
247246
},
248247
checkApp: func(t *testing.T, cmd applicationCmd, app *apps.Application) {
@@ -260,13 +259,13 @@ func TestCreateApplication(t *testing.T) {
260259
cmd: applicationCmd{
261260
Git: gitConfig{
262261
URL: "https://github.com/ninech/doesnotexist.git",
263-
SSHPrivateKey: ptr.To("not valid"),
262+
SSHPrivateKey: new("not valid"),
264263
},
265264
resourceCmd: resourceCmd{
266265
Wait: false,
267266
Name: "ssh-key-auth-non-valid",
268267
},
269-
Size: ptr.To("mini"),
268+
Size: new("mini"),
270269
SkipRepoAccessCheck: true,
271270
},
272271
errorExpected: true,
@@ -280,7 +279,7 @@ func TestCreateApplication(t *testing.T) {
280279
Wait: false,
281280
Name: "deploy-job-empty-command",
282281
},
283-
Size: ptr.To("mini"),
282+
Size: new("mini"),
284283
DeployJob: deployJob{Command: "", Name: "print-date", Retries: 2, Timeout: time.Minute},
285284
SkipRepoAccessCheck: true,
286285
},
@@ -298,7 +297,7 @@ func TestCreateApplication(t *testing.T) {
298297
Wait: false,
299298
Name: "deploy-job-empty-name",
300299
},
301-
Size: ptr.To("mini"),
300+
Size: new("mini"),
302301
DeployJob: deployJob{Command: "date", Name: "", Retries: 2, Timeout: time.Minute},
303302
SkipRepoAccessCheck: true,
304303
},
@@ -318,7 +317,7 @@ func TestCreateApplication(t *testing.T) {
318317
Wait: false,
319318
Name: "git-information-happy-path",
320319
},
321-
Size: ptr.To("mini"),
320+
Size: new("mini"),
322321
},
323322
gitInformationServiceResponse: test.GitInformationServiceResponse{
324323
Code: 200,
@@ -355,7 +354,7 @@ func TestCreateApplication(t *testing.T) {
355354
Wait: false,
356355
Name: "git-information-errors",
357356
},
358-
Size: ptr.To("mini"),
357+
Size: new("mini"),
359358
},
360359
gitInformationServiceResponse: test.GitInformationServiceResponse{
361360
Code: 200,
@@ -376,7 +375,7 @@ func TestCreateApplication(t *testing.T) {
376375
Wait: false,
377376
Name: "git-information-unknown-revision",
378377
},
379-
Size: ptr.To("mini"),
378+
Size: new("mini"),
380379
},
381380
gitInformationServiceResponse: test.GitInformationServiceResponse{
382381
Code: 200,
@@ -405,11 +404,11 @@ func TestCreateApplication(t *testing.T) {
405404
Wait: false,
406405
Name: "git-information-unknown-revision",
407406
},
408-
Size: ptr.To("mini"),
407+
Size: new("mini"),
409408
},
410409
gitInformationServiceResponse: test.GitInformationServiceResponse{
411410
Code: 501,
412-
Raw: ptr.To("maintenance mode - we will be back soon"),
411+
Raw: new("maintenance mode - we will be back soon"),
413412
},
414413
errorExpected: true,
415414
},
@@ -424,7 +423,7 @@ func TestCreateApplication(t *testing.T) {
424423
Wait: false,
425424
Name: "git-information-update-url-to-https",
426425
},
427-
Size: ptr.To("mini"),
426+
Size: new("mini"),
428427
},
429428
gitInformationServiceResponse: test.GitInformationServiceResponse{
430429
Code: 200,
@@ -514,7 +513,7 @@ func TestApplicationWait(t *testing.T) {
514513
WaitTimeout: time.Second * 5,
515514
Name: "some-name",
516515
},
517-
BasicAuth: ptr.To(true),
516+
BasicAuth: new(true),
518517
SkipRepoAccessCheck: true,
519518
}
520519
project := test.DefaultProject
@@ -540,7 +539,7 @@ func TestApplicationWait(t *testing.T) {
540539
Spec: apps.ReleaseSpec{
541540
ForProvider: apps.ReleaseParameters{
542541
Configuration: apps.Config{
543-
EnableBasicAuth: ptr.To(true),
542+
EnableBasicAuth: new(true),
544543
}.WithOrigin(apps.ConfigOriginApplication),
545544
},
546545
},

create/cloudvm_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/ninech/nctl/internal/test"
1111
"k8s.io/apimachinery/pkg/api/resource"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13-
"k8s.io/utils/ptr"
1413
)
1514

1615
func TestCloudVM(t *testing.T) {
@@ -38,7 +37,7 @@ func TestCloudVM(t *testing.T) {
3837
},
3938
{
4039
name: "bootDisk",
41-
create: cloudVMCmd{BootDiskSize: ptr.To(resource.MustParse("1Gi"))},
40+
create: cloudVMCmd{BootDiskSize: new(resource.MustParse("1Gi"))},
4241
want: infrastructure.CloudVirtualMachineParameters{
4342
BootDisk: &infrastructure.Disk{
4443
Name: "root", Size: resource.MustParse("1Gi"),

0 commit comments

Comments
 (0)