Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable unconvert and tenv linters #672

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ linters:
- nolintlint
- perfsprint
- prealloc
- tenv
- testifylint
- unparam
- unconvert
- wastedassign
4 changes: 2 additions & 2 deletions huma.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
11 changes: 3 additions & 8 deletions humacli/humacli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading