From 9c4f75b8208f744a2f16e692b45702db67db160e Mon Sep 17 00:00:00 2001 From: takahashi shun Date: Tue, 18 Nov 2025 23:20:15 +0900 Subject: [PATCH] Enable nofloats linter --- .golangci-kal.yml | 2 +- pkg/internal/rate/rate.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.golangci-kal.yml b/.golangci-kal.yml index ab8ed03edf..3d85b0b949 100644 --- a/.golangci-kal.yml +++ b/.golangci-kal.yml @@ -23,7 +23,7 @@ linters: #- "jsontags" # Ensure every field has a json tag. #- "maxlength" # Ensure all strings and arrays have maximum lengths/maximum items. #- "nobools" # Bools do not evolve over time, should use enums instead. - #- "nofloats" # Ensure floats are not used. + - "nofloats" # Ensure floats are not used. #- "optionalorrequired" # Every field should be marked as `+optional` or `+required`. # - "requiredfields" # Required fields should not be pointers, and should not have `omitempty`. - "statussubresource" # All root objects that have a `status` field should have a status subresource. diff --git a/pkg/internal/rate/rate.go b/pkg/internal/rate/rate.go index 607f13f799..0e992b1ad3 100644 --- a/pkg/internal/rate/rate.go +++ b/pkg/internal/rate/rate.go @@ -30,6 +30,8 @@ import ( // Limit defines the maximum frequency of some events. // Limit is represented as number of events per second. // A zero Limit allows no events. +// +//nolint:kubeapilinter // This is an internal rate limiter implementation, not a Kubernetes API type Limit float64 // Inf is the infinite rate limit; it allows all events (even if burst is zero). @@ -66,6 +68,8 @@ func Every(interval time.Duration) Limit { // or its associated context.Context is canceled. // // The methods AllowN, ReserveN, and WaitN consume n tokens. +// +//nolint:kubeapilinter // This is an internal rate limiter implementation, not a Kubernetes API type Limiter struct { mu sync.Mutex limit Limit @@ -117,6 +121,8 @@ func (lim *Limiter) AllowN(now time.Time, n int) bool { // A Reservation holds information about events that are permitted by a Limiter to happen after a delay. // A Reservation may be canceled, which may enable the Limiter to permit additional events. +// +//nolint:kubeapilinter // This is an internal rate limiter implementation, not a Kubernetes API type Reservation struct { ok bool lim *Limiter