Skip to content

Commit

Permalink
feat: avoid typed nil
Browse files Browse the repository at this point in the history
  • Loading branch information
FGYFFFF committed Sep 27, 2024
1 parent fc59bc7 commit 122001c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/hz/generator/package_tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ func (r *request) setQueryParam(param string, value interface{}) *request {
return r
}
v := reflect.ValueOf(value)
if v.Kind() == reflect.Pointer && v.IsNil() {
return r
}
switch v.Kind() {
case reflect.Slice, reflect.Array:
for index := 0; index < v.Len(); index++ {
Expand Down

0 comments on commit 122001c

Please sign in to comment.