Skip to content

Commit 3d0f111

Browse files
committed
fix(cdn) replace utils.Min usage with builtin min
1 parent 76d91fb commit 3d0f111

File tree

3 files changed

+2
-51
lines changed

3 files changed

+2
-51
lines changed

internal/cmd/beta/cdn/distribution/list/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ func fetchDistributions(ctx context.Context, model *inputModel, apiClient *cdn.A
151151
received := int32(0)
152152
limit := int32(math.MaxInt32)
153153
if model.Limit != nil {
154-
limit = utils.Min(limit, *model.Limit)
154+
limit = min(limit, *model.Limit)
155155
}
156156
for {
157-
want := utils.Min(maxPageSize, limit-received)
157+
want := min(maxPageSize, limit-received)
158158
request := buildRequest(ctx, model, apiClient, nextPageID, want)
159159
response, err := request.Execute()
160160
if err != nil {

internal/pkg/utils/utils.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/stackitcloud/stackit-cli/internal/pkg/config"
1515
sdkConfig "github.com/stackitcloud/stackit-sdk-go/core/config"
1616
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
17-
"golang.org/x/exp/constraints"
1817
)
1918

2019
// Ptr Returns the pointer to any type T
@@ -260,10 +259,3 @@ func GetSliceFromPointer[T any](s *[]T) []T {
260259
}
261260
return *s
262261
}
263-
264-
func Min[T constraints.Ordered](a, b T) T {
265-
if a < b {
266-
return a
267-
}
268-
return b
269-
}

internal/pkg/utils/utils_test.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -590,44 +590,3 @@ func TestGetSliceFromPointer(t *testing.T) {
590590
})
591591
}
592592
}
593-
594-
func TestMin(t *testing.T) {
595-
tests := []struct {
596-
name string
597-
a, b int
598-
want int
599-
}{
600-
{
601-
name: "min(0, 0) = 0",
602-
a: 0,
603-
b: 0,
604-
want: 0,
605-
},
606-
{
607-
name: "min(1, 2) = 1",
608-
a: 1,
609-
b: 2,
610-
want: 1,
611-
},
612-
{
613-
name: "min(2, 1) = 1",
614-
a: 2,
615-
b: 1,
616-
want: 1,
617-
},
618-
{
619-
name: "min(-1, 1) = -1",
620-
a: -1,
621-
b: 1,
622-
want: -1,
623-
},
624-
}
625-
for _, tt := range tests {
626-
t.Run(tt.name, func(t *testing.T) {
627-
if got := Min(tt.a, tt.b); got != tt.want {
628-
t.Errorf("Min() = %v, want %v", got, tt.want)
629-
}
630-
})
631-
}
632-
633-
}

0 commit comments

Comments
 (0)