From 0f3ecad613e79be2d123b4d2d78f32ef947dba29 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Tue, 10 Sep 2024 15:41:03 +0200 Subject: [PATCH] Satisfy linter (#567) --- cmd/metal-api/internal/datastore/integer.go | 2 +- cmd/metal-api/internal/datastore/shared_mutex.go | 4 ---- cmd/metal-api/internal/datastore/shared_mutex_test.go | 4 ++++ cmd/metal-api/internal/grpc/boot-service_test.go | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/metal-api/internal/datastore/integer.go b/cmd/metal-api/internal/datastore/integer.go index 818db0670..840a01c93 100644 --- a/cmd/metal-api/internal/datastore/integer.go +++ b/cmd/metal-api/internal/datastore/integer.go @@ -225,7 +225,7 @@ func makeRange(min, max uint) []integer { a := make([]integer, max-min+1) for i := range a { a[i] = integer{ - ID: min + uint(i), + ID: min + uint(i), // nolint:gosec } } return a diff --git a/cmd/metal-api/internal/datastore/shared_mutex.go b/cmd/metal-api/internal/datastore/shared_mutex.go index 47007d1ec..f34220b30 100644 --- a/cmd/metal-api/internal/datastore/shared_mutex.go +++ b/cmd/metal-api/internal/datastore/shared_mutex.go @@ -76,10 +76,6 @@ type lockOptAcquireTimeout struct { timeout time.Duration } -func newLockOptAcquireTimeout(t time.Duration) *lockOptAcquireTimeout { - return &lockOptAcquireTimeout{timeout: t} -} - func (m *sharedMutex) lock(ctx context.Context, key string, expiration time.Duration, opts ...lockOpt) error { timeout := defaultSharedMutexAcquireTimeout for _, opt := range opts { diff --git a/cmd/metal-api/internal/datastore/shared_mutex_test.go b/cmd/metal-api/internal/datastore/shared_mutex_test.go index 888685e61..3dd620b3a 100644 --- a/cmd/metal-api/internal/datastore/shared_mutex_test.go +++ b/cmd/metal-api/internal/datastore/shared_mutex_test.go @@ -16,6 +16,10 @@ import ( r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) +func newLockOptAcquireTimeout(t time.Duration) *lockOptAcquireTimeout { + return &lockOptAcquireTimeout{timeout: t} +} + func Test_sharedMutex_reallyLocking(t *testing.T) { defer mutexCleanup(t) ctx := context.Background() diff --git a/cmd/metal-api/internal/grpc/boot-service_test.go b/cmd/metal-api/internal/grpc/boot-service_test.go index b0132ca8e..147a249dc 100644 --- a/cmd/metal-api/internal/grpc/boot-service_test.go +++ b/cmd/metal-api/internal/grpc/boot-service_test.go @@ -40,7 +40,7 @@ func TestBootService_Register(t *testing.T) { name string uuid string numcores int - memory int + memory uint64 dbsizes []metal.Size dbmachines metal.Machines neighbormac1 metal.MacAddress @@ -121,7 +121,7 @@ func TestBootService_Register(t *testing.T) { req := &v1.BootServiceRegisterRequest{ Uuid: tt.uuid, Hardware: &v1.MachineHardware{ - Memory: uint64(tt.memory), + Memory: tt.memory, Disks: []*v1.MachineBlockDevice{ { Size: 1000000000000,