Skip to content

Commit

Permalink
Fall through to default case for strings, but leave warning comment…
Browse files Browse the repository at this point in the history
… to make it clear it was an intentional decision to fall through for strings.
  • Loading branch information
bbrks committed Nov 29, 2023
1 parent 3fc4c51 commit eceb0b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1309,9 +1309,9 @@ func InjectJSONProperties(b []byte, kvPairs ...KVPair) (new []byte, err error) {
valBytes = []byte(strconv.FormatUint(v, 10))
case bool:
valBytes = []byte(strconv.FormatBool(v))
case string:
// it's not safe to use strings without marshalling
valBytes = []byte(ConvertToJSONString(v))
// case string:
// it's not safe to use strings without marshalling
// fall through to default below
default:
valBytes, err = JSONMarshal(kv.Val)
}
Expand Down

0 comments on commit eceb0b5

Please sign in to comment.