Skip to content

Commit f773023

Browse files
authored
Fix deprecations (#2331)
1 parent 9e83428 commit f773023

File tree

75 files changed

+588
-531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+588
-531
lines changed

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ linters:
7171
- revive
7272
path: _test\.go
7373
text: 'dot-imports: should not use dot imports'
74-
- linters:
75-
- staticcheck
76-
text: 'SA1019:'
7774
- linters:
7875
- govet
7976
text: declaration of "(err|ctx)" shadows declaration at

api/v1beta2/foundationdb_status_test.go

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
. "github.com/onsi/ginkgo/v2"
3232
. "github.com/onsi/gomega"
3333
"github.com/onsi/gomega/format"
34-
"k8s.io/utils/pointer"
34+
"k8s.io/utils/ptr"
3535
)
3636

3737
var _ = Describe("FoundationDBStatus", func() {
@@ -63,8 +63,8 @@ var _ = Describe("FoundationDBStatus", func() {
6363
},
6464
VersionFlags: VersionFlags{LogSpill: 2, LogVersion: 0},
6565
StorageMigrationType: &migrationType,
66-
PerpetualStorageWiggle: pointer.Int(0),
67-
PerpetualStorageWiggleLocality: pointer.String("0"),
66+
PerpetualStorageWiggle: ptr.To(0),
67+
PerpetualStorageWiggleLocality: ptr.To("0"),
6868
},
6969
Processes: map[ProcessGroupID]FoundationDBStatusProcessInfo{
7070
"eb48ada3a682e86363f06aa89e1041fa": {
@@ -90,14 +90,14 @@ var _ = Describe("FoundationDBStatus", func() {
9090
ID: "0de7f5c5e549cad1",
9191
GRVLatencyStatistics: FoundationDBStatusGRVStatistics{
9292
Batch: FoundationDBStatusPerfStatistics{
93-
Count: pointer.Int(6),
94-
Median: pointer.Float64(0.000531435),
95-
P99: pointer.Float64(0.00130677),
93+
Count: ptr.To(6),
94+
Median: ptr.To(0.000531435),
95+
P99: ptr.To(0.00130677),
9696
},
9797
Default: FoundationDBStatusPerfStatistics{
98-
Count: pointer.Int(225),
99-
Median: pointer.Float64(0.00062561),
100-
P99: pointer.Float64(0.010715200000000001),
98+
Count: ptr.To(225),
99+
Median: ptr.To(0.00062561),
100+
P99: ptr.To(0.010715200000000001),
101101
},
102102
},
103103
},
@@ -108,14 +108,14 @@ var _ = Describe("FoundationDBStatus", func() {
108108
Seconds: 0.19625800000000002,
109109
Versions: 196258,
110110
},
111-
KVStoreUsedBytes: pointer.Int64(104878232),
112-
KVStoreTotalBytes: pointer.Int64(135012552704),
113-
KVStoreFreeBytes: pointer.Int64(84178223104),
114-
KVStoreAvailableBytes: pointer.Int64(84178223104),
111+
KVStoreUsedBytes: ptr.To[int64](104878232),
112+
KVStoreTotalBytes: ptr.To[int64](135012552704),
113+
KVStoreFreeBytes: ptr.To[int64](84178223104),
114+
KVStoreAvailableBytes: ptr.To[int64](84178223104),
115115
ReadLatencyStatistics: FoundationDBStatusPerfStatistics{
116-
Count: pointer.Int(297),
117-
Median: pointer.Float64(0.000116825),
118-
P99: pointer.Float64(0.000711441),
116+
Count: ptr.To(297),
117+
Median: ptr.To(0.000116825),
118+
P99: ptr.To(0.000711441),
119119
},
120120
},
121121
},
@@ -146,14 +146,14 @@ var _ = Describe("FoundationDBStatus", func() {
146146
Seconds: 2.1227,
147147
Versions: 2122697,
148148
},
149-
KVStoreUsedBytes: pointer.Int64(104878232),
150-
KVStoreTotalBytes: pointer.Int64(135012552704),
151-
KVStoreFreeBytes: pointer.Int64(84178239488),
152-
KVStoreAvailableBytes: pointer.Int64(84178239488),
149+
KVStoreUsedBytes: ptr.To[int64](104878232),
150+
KVStoreTotalBytes: ptr.To[int64](135012552704),
151+
KVStoreFreeBytes: ptr.To[int64](84178239488),
152+
KVStoreAvailableBytes: ptr.To[int64](84178239488),
153153
ReadLatencyStatistics: FoundationDBStatusPerfStatistics{
154-
Count: pointer.Int(334),
155-
Median: pointer.Float64(0.000102282),
156-
P99: pointer.Float64(0.000386477),
154+
Count: ptr.To(334),
155+
Median: ptr.To(0.000102282),
156+
P99: ptr.To(0.000386477),
157157
},
158158
},
159159
{
@@ -185,9 +185,9 @@ var _ = Describe("FoundationDBStatus", func() {
185185
Role: string(ProcessRoleCommitProxy),
186186
ID: "0eb90e4a0ece85b3",
187187
CommitLatencyStatistics: FoundationDBStatusPerfStatistics{
188-
Count: pointer.Int(31),
189-
Median: pointer.Float64(0.00794888),
190-
P99: pointer.Float64(0.09054090000000001),
188+
Count: ptr.To(31),
189+
Median: ptr.To(0.00794888),
190+
P99: ptr.To(0.09054090000000001),
191191
},
192192
},
193193
{
@@ -197,14 +197,14 @@ var _ = Describe("FoundationDBStatus", func() {
197197
Seconds: 0.19625800000000002,
198198
Versions: 196258,
199199
},
200-
KVStoreUsedBytes: pointer.Int64(104861752),
201-
KVStoreTotalBytes: pointer.Int64(135012552704),
202-
KVStoreFreeBytes: pointer.Int64(84178112512),
203-
KVStoreAvailableBytes: pointer.Int64(84178112512),
200+
KVStoreUsedBytes: ptr.To[int64](104861752),
201+
KVStoreTotalBytes: ptr.To[int64](135012552704),
202+
KVStoreFreeBytes: ptr.To[int64](84178112512),
203+
KVStoreAvailableBytes: ptr.To[int64](84178112512),
204204
ReadLatencyStatistics: FoundationDBStatusPerfStatistics{
205-
Count: pointer.Int(0),
206-
Median: pointer.Float64(0),
207-
P99: pointer.Float64(0),
205+
Count: ptr.To(0),
206+
Median: ptr.To(0.0),
207+
P99: ptr.To(0.0),
208208
},
209209
},
210210
},
@@ -286,10 +286,10 @@ var _ = Describe("FoundationDBStatus", func() {
286286
{
287287
Role: string(ProcessRoleLog),
288288
ID: "2c66a861b33b2697",
289-
KVStoreUsedBytes: pointer.Int64(104861752),
290-
KVStoreTotalBytes: pointer.Int64(135012552704),
291-
KVStoreFreeBytes: pointer.Int64(84178214912),
292-
KVStoreAvailableBytes: pointer.Int64(84178214912),
289+
KVStoreUsedBytes: ptr.To[int64](104861752),
290+
KVStoreTotalBytes: ptr.To[int64](135012552704),
291+
KVStoreFreeBytes: ptr.To[int64](84178214912),
292+
KVStoreAvailableBytes: ptr.To[int64](84178214912),
293293
},
294294
},
295295
Messages: []FoundationDBStatusProcessMessage{},
@@ -314,10 +314,10 @@ var _ = Describe("FoundationDBStatus", func() {
314314
{
315315
Role: string(ProcessRoleLog),
316316
ID: "56cf105980ec2b07",
317-
KVStoreUsedBytes: pointer.Int64(104861752),
318-
KVStoreTotalBytes: pointer.Int64(135012552704),
319-
KVStoreFreeBytes: pointer.Int64(84178214912),
320-
KVStoreAvailableBytes: pointer.Int64(84178214912),
317+
KVStoreUsedBytes: ptr.To[int64](104861752),
318+
KVStoreTotalBytes: ptr.To[int64](135012552704),
319+
KVStoreFreeBytes: ptr.To[int64](84178214912),
320+
KVStoreAvailableBytes: ptr.To[int64](84178214912),
321321
},
322322
},
323323
Messages: []FoundationDBStatusProcessMessage{},
@@ -342,10 +342,10 @@ var _ = Describe("FoundationDBStatus", func() {
342342
{
343343
Role: string(ProcessRoleLog),
344344
ID: "31754d1d7d8d6f05",
345-
KVStoreUsedBytes: pointer.Int64(104861752),
346-
KVStoreTotalBytes: pointer.Int64(135012552704),
347-
KVStoreFreeBytes: pointer.Int64(84178202624),
348-
KVStoreAvailableBytes: pointer.Int64(84178202624),
345+
KVStoreUsedBytes: ptr.To[int64](104861752),
346+
KVStoreTotalBytes: ptr.To[int64](135012552704),
347+
KVStoreFreeBytes: ptr.To[int64](84178202624),
348+
KVStoreAvailableBytes: ptr.To[int64](84178202624),
349349
},
350350
},
351351
Messages: []FoundationDBStatusProcessMessage{},
@@ -373,10 +373,10 @@ var _ = Describe("FoundationDBStatus", func() {
373373
Name: "healthy",
374374
MinReplicasRemaining: 2,
375375
},
376-
UnhealthyServers: pointer.Int64(0),
376+
UnhealthyServers: ptr.To[int64](0),
377377
},
378378
},
379-
TotalDiskUsedBytes: pointer.Int64(629203472),
379+
TotalDiskUsedBytes: ptr.To[int64](629203472),
380380
},
381381
FullReplication: true,
382382
Clients: FoundationDBStatusClusterClientInfo{
@@ -498,7 +498,7 @@ var _ = Describe("FoundationDBStatus", func() {
498498
},
499499
},
500500
Layers: FoundationDBStatusLayerInfo{
501-
Valid: pointer.Bool(true),
501+
Valid: ptr.To(true),
502502
Backup: FoundationDBStatusBackupInfo{Paused: false, Tags: nil},
503503
Error: "",
504504
},
@@ -540,12 +540,12 @@ var _ = Describe("FoundationDBStatus", func() {
540540
},
541541
Generation: 2,
542542
BounceImpact: FoundationDBBounceImpact{
543-
CanCleanBounce: pointer.Bool(true),
543+
CanCleanBounce: ptr.To(true),
544544
},
545-
DatabaseAvailable: pointer.Bool(true),
546-
ActivePrimaryDC: pointer.String(""),
545+
DatabaseAvailable: ptr.To(true),
546+
ActivePrimaryDC: ptr.To(""),
547547
DatabaseLockState: FoundationDBStatusLockState{
548-
Locked: pointer.Bool(false),
548+
Locked: ptr.To(false),
549549
},
550550
}
551551

api/v1beta2/foundationdbbackup_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import (
2121
"net/url"
2222
"strings"
2323

24+
"k8s.io/utils/ptr"
25+
2426
corev1 "k8s.io/api/core/v1"
2527
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26-
"k8s.io/utils/pointer"
2728
)
2829

2930
// +kubebuilder:object:root=true
@@ -254,7 +255,7 @@ func (backup *FoundationDBBackup) BackupURL() string {
254255

255256
// SnapshotPeriodSeconds gets the period between snapshots for a backup.
256257
func (backup *FoundationDBBackup) SnapshotPeriodSeconds() int {
257-
return pointer.IntDeref(backup.Spec.SnapshotPeriodSeconds, 864000)
258+
return ptr.Deref(backup.Spec.SnapshotPeriodSeconds, 864000)
258259
}
259260

260261
// FoundationDBLiveBackupStatus describes the live status of the backup for a
@@ -283,7 +284,7 @@ type FoundationDBLiveBackupStatusState struct {
283284
// GetDesiredAgentCount determines how many backup agents we should run
284285
// for a cluster.
285286
func (backup *FoundationDBBackup) GetDesiredAgentCount() int {
286-
return pointer.IntDeref(backup.Spec.AgentCount, 2)
287+
return ptr.Deref(backup.Spec.AgentCount, 2)
287288
}
288289

289290
// CheckReconciliation compares the spec and the status to determine if
@@ -332,7 +333,7 @@ func (backup *FoundationDBBackup) CheckReconciliation() (bool, error) {
332333

333334
// GetAllowTagOverride returns the bool value for AllowTagOverride
334335
func (foundationDBBackupSpec *FoundationDBBackupSpec) GetAllowTagOverride() bool {
335-
return pointer.BoolDeref(foundationDBBackupSpec.AllowTagOverride, false)
336+
return ptr.Deref(foundationDBBackupSpec.AllowTagOverride, false)
336337
}
337338

338339
// UseUnifiedImage returns true if the unified image should be used.

0 commit comments

Comments
 (0)