Skip to content

Commit

Permalink
Use strconv.AppendBool for adding bools (uber-go#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantv authored Sep 25, 2016
1 parent 47f4135 commit 47323e2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions json_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ func (enc *jsonEncoder) AddString(key, val string) {
// key is JSON-escaped.
func (enc *jsonEncoder) AddBool(key string, val bool) {
enc.addKey(key)
if val {
enc.bytes = append(enc.bytes, "true"...)
return
}
enc.bytes = append(enc.bytes, "false"...)
enc.bytes = strconv.AppendBool(enc.bytes, val)
}

// AddInt adds a string key and integer value to the encoder's fields. The key
Expand Down

0 comments on commit 47323e2

Please sign in to comment.