Releases: codepuke/gobspect
Releases · codepuke/gobspect
v0.2.0
Full Changelog: v0.1.0...v0.2.0
Breaking
sortval.SortSpec.Desc boolis replaced by per-key directions.Keys
is now[]SortKey, whereSortKeyis{Field string; Desc bool}, so a
single spec can mix ascending and descending keys (e.g.Name,Score:desc).
The signature ofParseSortSpecis unchanged except for the meaning of the
third argument:descis now the default direction applied only to keys
with no explicit:asc/:descsuffix.gq -sort-descis now "default direction", not a hard override.
Combine it with per-key:ascsuffixes to mix directions.- Error messages from
Stream.Values()andStream.Messages()are now
wrapped withgob: message N at offset B: …prefixes. Tools that string-
match against the previous error text will need to update.
Added
gq -diff PATH— structural diff against another.gobfile, aligned
by index. Exits 1 when any position differs, 0 otherwise. Pairs with
-format jsonfor a machine-readable delta tree.gq -stats— stream-level summary: message counts, body bytes, per-
type record counts and byte consumption, struct field presence rates, and
opaque decoder coverage.-format jsonemits the same data as JSON.gq -format jsonl— one compact JSON value per line, ideal for piping
intojqwithout materialising the whole stream.gq -schema-format json— machine-readable schema output (array of
type declarations withname,kind,fields/target/annotation)
for downstream tooling.gq -skip-errors— continue past value-decode failures instead of
aborting; the skip count is available viaStream.SkipCount().gq -count,-sum,-min,-max,-avg— single-pass aggregators
over the query match set. Numeric aggregators take a path expression
relative to each match.gq -sort Name:asc,Score:desc— per-key sort directions alongside
the existing multi-key sort.- Per-partition sort for
gq -hetero partition— the documented-but-
unimplemented feature now sorts within each partition independently and
emits partitions in arrival order. gobspect.Equal(a, b Value) bool— strict structural equality that
complementsCompareValues. Kind-for-kind only; no cross-numeric coercion.gobspect.MessageInfo+Stream.Messages()— iterator yielding one
MessageInfoper length-prefixed frame (offset, body length, type ID,
raw body), without forcing a full value decode. Enables size profiling
and stream indexing.gobspect.WithSkipCorruptValues(bool)— Inspector option pair for the
CLI's-skip-errors; type-definition errors remain fatal to keep the
type registry consistent.Stream.Stats() (*Stats, error)+Stats.Format,Stats.JSON,
Stats.JSONIndent— single-pass population-level statistics over a
stream.Schema.JSON()andSchema.JSONIndent()— machine-readable schema
rendering; mirrors the newgq -schema-format jsonoutput.- Static recursive-descent in
query.SchemaAt—..Nameexpressions
are resolved by widening the search to every reachable type and returning
the sorted, pipe-joined union of distinct result types (e.g.int|string).
Previously this returned an error. - Built-in opaque decoders for
net/netip.Addr,netip.Prefix,
netip.AddrPort— BinaryMarshaler blobs decoded via stdlib
UnmarshalBinary, stored inOpaqueValue.Decodedas canonical strings
so the Value AST stays free of inspected types. - New
gobspect/diffsubpackage —Diff,DiffStreams,DeltaAST
(Added/Removed/Changed/StructDelta/MapDelta/SliceDelta/ArrayDelta), plus
text and JSON renderers. Thegq -diffflag is the CLI surface. - Colorized diff output —
diff.ColorScheme,diff.ANSIColorScheme, and
diff.WithColormirror the existinggobspect.WithColorpattern.gq -diff
auto-enables ANSI color when stdout is a TTY;-color/-no-colorforce
either mode. JSON diff output stays plain.
Changed
gq -sort-descsemantics moved from "flip every key" to "default for
keys without:asc/:desc", enabling mixed-direction sorts.- Error reporting now includes message index and byte offset for every
value-level and framing-level decode failure (see Breaking). Inspector.WithReadLimit(0)handling is clarified: the byte counter
is always active (it powersMessageInfo.Offsetand error diagnostics);
the zero limit simply disables the ceiling check.gobspect.Style.applyrenamed toStyle.Applyso other subpackages
(notablydiff) can render through the shared style type. Internal-only
rename; no deprecation shim.
Fixed
time.Timesub-minute negative-offset round-trip now recovers the
original zone offset. The stdlib'stime.UnmarshalBinaryreads byte 15 of
the version-2 payload asuint8, losing the sign for values like0xFE
(see BUG_REPORT.md). Our clean-room decoder reads it asint8and
returns the correct offset — the decoder deliberately diverges from the
stdlib bug.
Test / infrastructure
- Coverage raised on previously-untested public API:
ParseBytesFormat,
Schema.TypeByName,Stream.Stats,Stats.Format,Stats.JSON,
Stats.JSONIndent, the diff package's formatters, and per-feature CLI
integration tests for all new flags. - All v0.2.0 features land with behavior tests; no deprecation shims are
maintained for pre-0.2 callers because the project has no external users
yet.
v0.1.0
This is the initial release.
Full Changelog: https://github.com/codepuke/gobspect/commits/v0.1.0