From d332422971fe65d56169ee7d41ca96919139a665 Mon Sep 17 00:00:00 2001 From: Stephane Guy Date: Thu, 3 Oct 2024 11:10:09 +0200 Subject: [PATCH] fix golangci-lint errors --- huma.go | 10 +++++----- huma_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/huma.go b/huma.go index 74b371b9..0f30ecb4 100644 --- a/huma.go +++ b/huma.go @@ -1294,19 +1294,19 @@ func Register[I, O any](api API, op Operation, handler func(context.Context, *I) } } else { // Set defaults for any fields that were not in the input: - atLeastOneFieldIsOverriden := false + atLeastOneFieldIsOverridden := false defaults.Every(v, func(item reflect.Value, def any) { if item.IsZero() && !reflect.ValueOf(def).IsZero() { // There is one caveat here: // - IF the default value is not the 'zero' of the field type // - AND the 'zero' of the field type is a valid value specified in the input - // - THEN the input required field value is overriden with a different value + // - THEN the input required field value is overridden with a different value item.Set(reflect.Indirect(reflect.ValueOf(def))) - atLeastOneFieldIsOverriden = true + atLeastOneFieldIsOverridden = true } }) - // Restore wrongly overriden input values if any - if atLeastOneFieldIsOverriden { + // Restore wrongly overridden input values if any + if atLeastOneFieldIsOverridden { _ = api.Unmarshal(ctx.Header("Content-Type"), body, f.Addr().Interface()) } } diff --git a/huma_test.go b/huma_test.go index 5683cd7b..e80ba803 100644 --- a/huma_test.go +++ b/huma_test.go @@ -627,7 +627,7 @@ func TestFeatures(t *testing.T) { assert.Equal(t, 5, input.Body.Count) assert.Equal(t, []string{"foo", "bar"}, input.Body.Tags) assert.Equal(t, []int{1, 2, 3}, input.Body.Numbers) - assert.Equal(t, len(input.Body.Items), 2) + assert.Len(t, input.Body.Items, 2) assert.Equal(t, 1, input.Body.Items[0].ID) assert.True(t, input.Body.Items[0].Verified) assert.Equal(t, 1, input.Body.Items[1].ID)