Skip to content

Commit

Permalink
fix: panic on uncomparable log attrs (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitry Selivanov <dmitry@gateway.fm>
  • Loading branch information
dmitriyselivanov and Dmitry Selivanov authored Jul 3, 2024
1 parent e176b7d commit c651e10
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clog/attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ func ConvertToAttrs(fields Fields) []any {
}

func isZeroValue(v interface{}) bool {
return v == reflect.Zero(reflect.TypeOf(v)).Interface()
t := reflect.TypeOf(v)
if !t.Comparable() {
return false
}
return v == reflect.Zero(t).Interface()
}

0 comments on commit c651e10

Please sign in to comment.