From c1ac658449d9e38a47e945a808efa91f65a8b02b Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Thu, 5 Dec 2024 18:38:06 +0200 Subject: [PATCH] chore: enable unconvert and tenv linters --- .golangci.yml | 2 ++ huma.go | 4 ++-- humacli/humacli_test.go | 11 +++-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 576244f5..9e9a0ca9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,6 +8,8 @@ linters: - nolintlint - perfsprint - prealloc + - tenv - testifylint - unparam + - unconvert - wastedassign diff --git a/huma.go b/huma.go index 931d80cb..81bc78c9 100644 --- a/huma.go +++ b/huma.go @@ -1091,7 +1091,7 @@ func Register[I, O any](api API, op Operation, handler func(context.Context, *I) if err != nil { return 0, err } - return int64(val), nil + return val, nil }) if err != nil { res.Add(pb, value, "invalid integer") @@ -1151,7 +1151,7 @@ func Register[I, O any](api API, op Operation, handler func(context.Context, *I) if err != nil { return 0, err } - return uint64(val), nil + return val, nil }) if err != nil { res.Add(pb, value, "invalid integer") diff --git a/humacli/humacli_test.go b/humacli/humacli_test.go index e776829c..1f27b318 100644 --- a/humacli/humacli_test.go +++ b/humacli/humacli_test.go @@ -95,14 +95,9 @@ func TestCLIEnv(t *testing.T) { Port int } - os.Setenv("SERVICE_DEBUG", "true") - os.Setenv("SERVICE_HOST", "localhost") - os.Setenv("SERVICE_PORT", "8001") - defer func() { - os.Unsetenv("SERVICE_DEBUG") - os.Unsetenv("SERVICE_HOST") - os.Unsetenv("SERVICE_PORT") - }() + t.Setenv("SERVICE_DEBUG", "true") + t.Setenv("SERVICE_HOST", "localhost") + t.Setenv("SERVICE_PORT", "8001") cli := humacli.New(func(hooks humacli.Hooks, options *Options) { assert.True(t, options.Debug)