Repository navigation
Conversation
hanzei
left a comment
There was a problem hiding this comment.
Thanks!
Can you please explain why URLValuesSliceKeySuffix needs to be exported? What value does it add for callers?
|
Hi @hanzei, thanks for the review! The motivation for adding the
That being said, if you prefer keeping the public API surface minimal and not exposing the getter, I am more than happy to remove Let me know what you prefer and I can update the branch accordingly. |
hanzei
left a comment
There was a problem hiding this comment.
Thanks for the context. you're right that it was exported briefly in 2018 another PR made it private, so the comment has just been stale since then. That said, I'd prefer to keep the API surface as is: callers that change the suffix already know what they set it to, and save/restore is mostly a test concern. Please drop the URLValuesSliceKeySuffix() getter and the test changes, but keep the doc comment rename. The []map[any]any fix looks good and we can merge once that's done.
Summary
Clean
[]map[any]anyslices before JSON encoding:cleanUp(v any)previously supported[]any,[]map[string]any,[]Map, andmap[any]any, but omitted[]map[any]any(slices of interface maps commonly produced by YAML unmarshalers or dynamic data).[]anyin Go type switches,[]map[any]anyfell through todefault: return v, resulting injson: unsupported type: map[interface {}]interface {}when callingJSON()orBase64().cleanUpInterfaceMapArray(in []map[any]any) []Mapand registeredcase []map[any]any:incleanUp.Add
URLValuesSliceKeySuffixgetter:conversions.gopreviously referenced an exportedURLValuesSliceKeySuffixvariable, which was replaced by an unexported variable andSetURLValuesSliceKeySuffix(s string).URLValuesSliceKeySuffix() stringto allow callers and tests to inspect and safely restore previous suffixes without hardcoding default constants.Tests:
[]map[any]anyinconversions_nil_test.goandconversions_test.go.URLValuesSliceKeySuffix()getter alongsideSetURLValuesSliceKeySuffix.go test -v ./...).