github stretchr/objx v0.6.0

latest release: v0.7.0
6 hours ago

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 every Where* method (WhereInt, WhereStr, WhereMSI, WhereObjxMap, …) returned the items for which the decider returned false, the opposite of what its documentation says. If you negated your decider to work around this, remove the negation. (#180)
  • Indexed Set updates the element instead of replacing the slice. Set("names[0]", "Mat") used to replace the whole names slice 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 null in JSON. objx.Map{"items": []any(nil)} now encodes as {"items":null} instead of {"items":[]}. Empty, non-nil containers still encode as [] / {}. (#171)
  • URLValues keeps every element of a slice of maps. With the [] and "" key suffixes, only the last element's values used to be kept. []any values (e.g. arrays decoded from JSON) are now encoded element by element instead of as a Go-syntax string. (#177)
  • The error returned by SetURLValuesSliceKeySuffix for an invalid suffix now reads objx: invalid URLValuesSliceKeySuffix provided. (#176)

Other

  • The API now uses any instead of interface{}. 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 #163
  • Fix flaky TestConversionURLValues when run with -shuffle by @hanzei in #165
  • Bump go-task/setup-task from 1 to 2 by @dependabot[bot] in #166
  • Bump actions/checkout from 6 to 7 by @dependabot[bot] in #167
  • Bump actions/setup-go from 6 to 7 by @dependabot[bot] in #168
  • Preserve slices when setting an indexed value by @vitalivo in #170
  • Preserve null values when converting nil containers to JSON by @x0Lazarus in #171
  • Modernize: use any, require Go 1.25, apply go fix by @hanzei in #175
  • Add golangci-lint and run it in CI by @hanzei in #176
  • Enable more linters and the gofumpt and goimports formatters by @hanzei in #178
  • Cover nested URL values and keep repeated map-slice entries by @hanzei in #177
  • Replace the browser-based codegen with go generate by @hanzei in #179
  • Fix Where* returning the items the decider rejected by @hanzei in #180

New Contributors

Full Changelog: v0.5.3...v0.6.0

Don't miss a new objx release

NewReleases is sending notifications on new releases.