Upgrade notes
Go 1.25 or later is now required (previously Go 1.20). (#175)
Behavior changes
Where*now returns the items the decider selects. Previously everyWhere*method (WhereInt,WhereStr,WhereMSI,WhereObjxMap, …) returned the items for which the decider returnedfalse, the opposite of what its documentation says. If you negated your decider to work around this, remove the negation. (#180)- Indexed
Setupdates the element instead of replacing the slice.Set("names[0]", "Mat")used to replace the wholenamesslice with"Mat"; it now sets only the first element. Indexing into a value that isn't a slice (e.g.Get("name[0]")on a string) now returns a missing value instead of the value itself. (#170) - Nil slices and maps stay
nullin JSON.objx.Map{"items": []any(nil)}now encodes as{"items":null}instead of{"items":[]}. Empty, non-nil containers still encode as[]/{}. (#171) URLValueskeeps every element of a slice of maps. With the[]and""key suffixes, only the last element's values used to be kept.[]anyvalues (e.g. arrays decoded from JSON) are now encoded element by element instead of as a Go-syntax string. (#177)- The error returned by
SetURLValuesSliceKeySuffixfor an invalid suffix now readsobjx: invalid URLValuesSliceKeySuffix provided. (#176)
Other
- The API now uses
anyinstead ofinterface{}. They are the same type, so this doesn't affect callers. (#175) - The type-specific accessors are now generated with
go generate(#179), and CI runs golangci-lint (#176, #178).
What's Changed
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in https://github.com/stretchr/objx/pull/163
- Fix flaky TestConversionURLValues when run with -shuffle by @hanzei in https://github.com/stretchr/objx/pull/165
- Bump go-task/setup-task from 1 to 2 by @dependabot[bot] in https://github.com/stretchr/objx/pull/166
- Bump actions/checkout from 6 to 7 by @dependabot[bot] in https://github.com/stretchr/objx/pull/167
- Bump actions/setup-go from 6 to 7 by @dependabot[bot] in https://github.com/stretchr/objx/pull/168
- Preserve slices when setting an indexed value by @vitalivo in https://github.com/stretchr/objx/pull/170
- Preserve null values when converting nil containers to JSON by @x0Lazarus in https://github.com/stretchr/objx/pull/171
- Modernize: use any, require Go 1.25, apply go fix by @hanzei in https://github.com/stretchr/objx/pull/175
- Add golangci-lint and run it in CI by @hanzei in https://github.com/stretchr/objx/pull/176
- Enable more linters and the gofumpt and goimports formatters by @hanzei in https://github.com/stretchr/objx/pull/178
- Cover nested URL values and keep repeated map-slice entries by @hanzei in https://github.com/stretchr/objx/pull/177
- Replace the browser-based codegen with go generate by @hanzei in https://github.com/stretchr/objx/pull/179
- Fix Where* returning the items the decider rejected by @hanzei in https://github.com/stretchr/objx/pull/180
New Contributors
- @vitalivo made their first contribution in https://github.com/stretchr/objx/pull/170
- @x0Lazarus made their first contribution in https://github.com/stretchr/objx/pull/171
Full Changelog: https://github.com/stretchr/objx/compare/v0.5.3...v0.6.0