Commit d27b0d7
Drop marshalJSONString in favor of strconv.Quote
json.Marshal of a Go string cannot fail at runtime — encoding/json's
stringEncoder has no error path for valid Go strings. The helper existed
to placate errcheck rather than to catch a real failure mode, adding two
unreachable error branches per call site. strconv.Quote produces the
same JSON-encoded bytes with no error-checking overhead, and the call
sites become readable single expressions.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 8d7ff32 commit d27b0d7
1 file changed
Lines changed: 7 additions & 20 deletions
Lines changed: 7 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
222 | 218 | | |
223 | | - | |
224 | | - | |
| 219 | + | |
| 220 | + | |
225 | 221 | | |
226 | 222 | | |
227 | 223 | | |
| |||
232 | 228 | | |
233 | 229 | | |
234 | 230 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | 231 | | |
245 | 232 | | |
246 | 233 | | |
| |||
0 commit comments