Add v1-preserving format tags to time.Duration and [N]byte fields
ProprietaryAdd json:",format:nano" to time.Duration struct fields and json:",format:array" to fixed [N]byte array struct fields, whose default encoding/json/v2 encoding otherwise diverges from v1 (a duration string rather than a nanosecond number, and a base64 string rather than a number array). With the tag the field encodes identically under encoding/json and encoding/json/v2, so MigrateToJSONV2 migrates the file on its default path rather than leaving it for review. An existing json tag gains the option while its name and other options are kept, and a field that already pins a format is left unchanged.
org. openrewrite. golang. migration. AddV1FormatTagsmod run . --recipe= org. openrewrite. golang. migration. AddV1FormatTagsInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.