Compare commits
3
Commits
eb6ac1ab9d
...
75ade89f34
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75ade89f34 | ||
|
|
41786c5bc6 | ||
|
|
010a7b2a1e |
@@ -22,9 +22,9 @@ jobs:
|
|||||||
runs-on: fedora
|
runs-on: fedora
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
cache: true
|
cache: true
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ jobs:
|
|||||||
runs-on: fedora
|
runs-on: fedora
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
cache: true
|
cache: true
|
||||||
@@ -34,4 +34,4 @@ jobs:
|
|||||||
run: dnf install -y gcc
|
run: dnf install -y gcc
|
||||||
|
|
||||||
- name: Race
|
- name: Race
|
||||||
run: go test -race -count=1 -timeout 30m ./...
|
run: go test -race -count=1 -timeout 10m ./...
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# carries the CHANGELOG section as its body and nothing else. The gates still run first,
|
# carries the CHANGELOG section as its body and nothing else. The gates still run first,
|
||||||
# in their own job and once, minus the race detector: race never runs on a push path or a
|
# in their own job and once, minus the race detector: race never runs on a push path or a
|
||||||
# tag, and the local gate raced this tree before the tag was cut. The write permission
|
# tag, and the local gate raced this tree before the tag was cut. The write permission
|
||||||
# sits on the release job alone, and the version contract these steps implement is in the
|
# sits on the release job alone, and the version the binary reports is the one the
|
||||||
# `release` skill.
|
# toolchain records from the tag, with nothing injected.
|
||||||
#
|
#
|
||||||
# Every step is one command, so the step that fails is the gate that failed, and no shell
|
# Every step is one command, so the step that fails is the gate that failed, and no shell
|
||||||
# option has to be trusted for the run to stop. The scripted steps are Perl, not shell and
|
# option has to be trusted for the run to stop. The scripted steps are Perl, not shell and
|
||||||
@@ -31,9 +31,9 @@ jobs:
|
|||||||
runs-on: fedora
|
runs-on: fedora
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
# The module is the source of truth for the version, so it cannot drift.
|
# The module is the source of truth for the version, so it cannot drift.
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
@@ -77,7 +77,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Tests
|
- name: Tests
|
||||||
# Keep the pattern equal to `packages` in the project's justfile.
|
# Keep the pattern equal to `packages` in the project's justfile.
|
||||||
run: go test -count=1 -timeout 30m -coverprofile=coverage.out ./...
|
run: go test -count=1 -timeout 10m -coverprofile=coverage.out ./...
|
||||||
|
|
||||||
- name: Coverage floor
|
- name: Coverage floor
|
||||||
run: |
|
run: |
|
||||||
@@ -103,7 +103,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
releases: write
|
releases: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Install Perl
|
- name: Install Perl
|
||||||
# The runner images are minimal and Perl is not guaranteed. The install is a
|
# The runner images are minimal and Perl is not guaranteed. The install is a
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ jobs:
|
|||||||
runs-on: fedora
|
runs-on: fedora
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
# The module is the source of truth for the version, so it cannot drift.
|
# The module is the source of truth for the version, so it cannot drift.
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
- name: Tests
|
- name: Tests
|
||||||
# Scope the pattern to the packages that hold the logic when a thin cmd/ drags the
|
# Scope the pattern to the packages that hold the logic when a thin cmd/ drags the
|
||||||
# total under the floor, and keep it equal to `packages` in the project's justfile.
|
# total under the floor, and keep it equal to `packages` in the project's justfile.
|
||||||
run: go test -count=1 -timeout 30m -coverprofile=coverage.out ./...
|
run: go test -count=1 -timeout 10m -coverprofile=coverage.out ./...
|
||||||
|
|
||||||
- name: Coverage floor
|
- name: Coverage floor
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
+18
-12
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
## [2.0.0] - 2026-09-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
- `encoding.TextMarshaler` and `encoding.TextUnmarshaler` are honoured by
|
- `encoding.TextMarshaler` and `encoding.TextUnmarshaler` are honoured by
|
||||||
default, with no option to switch them off. A type that implements them is
|
default, with no option to switch them off. A type that implements them is
|
||||||
encoded as a TOML string and decoded from one: `net.IP` becomes
|
encoded as a TOML string and decoded from one: `net.IP` becomes
|
||||||
@@ -20,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- `time.Duration` is encoded in its canonical Go form as a TOML string,
|
- `time.Duration` is encoded in its canonical Go form as a TOML string,
|
||||||
`1h30m0s`, because TOML has no duration type; the decoder reads that string
|
`1h30m0s`, because TOML has no duration type; the decoder reads that string
|
||||||
back and still accepts a bare integer as the nanosecond count.
|
back and still accepts a bare integer as the nanosecond count.
|
||||||
- `interpres-decode -encode`, the adapter's other direction: it reads the
|
- `interpres-decode --encode`, the adapter's other direction: it reads the
|
||||||
toml-test tagged JSON from stdin and writes the TOML document it describes.
|
toml-test tagged JSON from stdin and writes the TOML document it describes.
|
||||||
The compliance suite now runs the encoder as well as the decoder, 214
|
The compliance suite now runs the encoder as well as the decoder, 214
|
||||||
encoder cases against the tagged JSON of the valid corpus.
|
encoder cases against the tagged JSON of the valid corpus.
|
||||||
@@ -47,8 +53,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
the plain type takes an offset date-time as it always did; code that asserts
|
the plain type takes an offset date-time as it always did; code that asserts
|
||||||
the tree's type, and `UnmarshalTOML` implementations that expect a
|
the tree's type, and `UnmarshalTOML` implementations that expect a
|
||||||
`time.Time`, need the new type.
|
`time.Time`, need the new type.
|
||||||
- `MaxNestingDepth(depth)` and `MaxInputSize(size)` options bound the parse a
|
- `MaxNestingDepth(depth)` and `MaxInputSize(size)` options bound the parse an
|
||||||
`Decode` performs, and every parse carries a nesting limit in any case
|
`Unmarshal` performs, and every parse carries a nesting limit in any case
|
||||||
(10000 levels, which no hand-written document approaches): a document that
|
(10000 levels, which no hand-written document approaches): a document that
|
||||||
nests arrays or inline tables deeper used to run the stack out and is now
|
nests arrays or inline tables deeper used to run the stack out and is now
|
||||||
rejected with a `SyntaxError` naming the limit.
|
rejected with a `SyntaxError` naming the limit.
|
||||||
@@ -57,7 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
header as one statement with its node, an `[[array of tables]]` as one
|
header as one statement with its node, an `[[array of tables]]` as one
|
||||||
statement per element. A caller that breaks after the statement it wanted
|
statement per element. A caller that breaks after the statement it wanted
|
||||||
reads no further ones. `examples/statements` shows the walk.
|
reads no further ones. `examples/statements` shows the walk.
|
||||||
- `ParseAs[T](data)`, the generic one-line decode, and `NewSchema[T]()`,
|
- `ParseAs[T](data, opts...)`, the generic one-line decode, and `NewSchema[T]()`,
|
||||||
which precompiles the struct schema and the interface flags for a hot path
|
which precompiles the struct schema and the interface flags for a hot path
|
||||||
before the first document arrives.
|
before the first document arrives.
|
||||||
- `EmitFieldComments(true)` prints the comment a field's `toml` tag
|
- `EmitFieldComments(true)` prints the comment a field's `toml` tag
|
||||||
@@ -101,26 +107,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
is an error wrapped with the key path.
|
is an error wrapped with the key path.
|
||||||
- `MarshalAppend(buf, v)` appends the TOML encoding of v to buf and returns
|
- `MarshalAppend(buf, v)` appends the TOML encoding of v to buf and returns
|
||||||
the extended buffer, the shape `json.MarshalAppend` has.
|
the extended buffer, the shape `json.MarshalAppend` has.
|
||||||
- `interpres-decode -version` prints the binary's version, the module version
|
- `interpres-decode --version` prints the binary's version, the module version
|
||||||
the toolchain recorded, so a release-built binary names its own tag.
|
the toolchain recorded, so a release-built binary names its own tag.
|
||||||
- `interpres-decode -json` prints plain indented JSON instead of the tagged
|
- `interpres-decode --json` prints plain indented JSON instead of the tagged
|
||||||
form, the shape for people and diffs, with the date-time wrappers in their
|
form, the shape for people and diffs, with the date-time wrappers in their
|
||||||
TOML form.
|
TOML form.
|
||||||
- `interpres-decode -validate` walks a named directory for `.toml` files and
|
- `interpres-decode --validate` walks a named directory for `.toml` files and
|
||||||
closes the sweep with a summary naming how many documents were checked and
|
closes the sweep with a summary naming how many documents were checked and
|
||||||
how many were invalid; single files stay quiet on success as before.
|
how many were invalid; single files stay quiet on success as before.
|
||||||
- `interpres-decode -struct` infers a Go struct definition from a document:
|
- `interpres-decode --struct` infers a Go struct definition from a document:
|
||||||
one field per key in written order, nested tables as nested struct types,
|
one field per key in written order, nested tables as nested struct types,
|
||||||
an array of tables as a slice. The printed type compiles and decodes the
|
an array of tables as a slice. The printed type compiles and decodes the
|
||||||
document it came from.
|
document it came from.
|
||||||
- `interpres-decode -schema TYPE file.go` writes a TOML template for the
|
- `interpres-decode --schema TYPE file.go` writes a TOML template for the
|
||||||
named struct type of a Go source, the `comment=` tag option printed as a
|
named struct type of a Go source, the `comment=` tag option printed as a
|
||||||
comment and the `default=` option as the value. It is the inverse of
|
comment and the `default=` option as the value. It is the inverse of
|
||||||
`-struct`.
|
`--struct`.
|
||||||
- `ParseFile(path)` reads the file and parses it into a `Document`, with the
|
- `ParseFile(path)` reads the file and parses it into a `Document`, with the
|
||||||
file name at the front of every error it returns, read failure and parse
|
file name at the front of every error it returns, read failure and parse
|
||||||
failure alike. `Valid(data)` reports whether a document parses, nil on
|
failure alike. `Valid(data)` reports whether a document parses, nil on
|
||||||
success and the parse error on failure, the library call the `-validate`
|
success and the parse error on failure, the library call the `--validate`
|
||||||
mode of interpres-decode is built on.
|
mode of interpres-decode is built on.
|
||||||
- `SyntaxError` carries the byte `Offset` the scan stopped at and the 1-based
|
- `SyntaxError` carries the byte `Offset` the scan stopped at and the 1-based
|
||||||
`Column` on the line, beside the line it always had, and `SourceLine(src)`
|
`Column` on the line, beside the line it always had, and `SourceLine(src)`
|
||||||
@@ -328,7 +334,7 @@ except where noted above.
|
|||||||
comments and trailing commas. The compliance suite runs in TOML 1.1 mode:
|
comments and trailing commas. The compliance suite runs in TOML 1.1 mode:
|
||||||
214 valid and 467 invalid cases, zero failures. Every TOML 1.0 document
|
214 valid and 467 invalid cases, zero failures. Every TOML 1.0 document
|
||||||
parses exactly as before.
|
parses exactly as before.
|
||||||
- `interpres-decode -validate [file ...]`: a validate mode beside the
|
- `interpres-decode --validate [file ...]`: a validate mode beside the
|
||||||
toml-test adapter. It parses each named file, or stdin when none are named,
|
toml-test adapter. It parses each named file, or stdin when none are named,
|
||||||
prints one line per invalid document to stderr, and exits 0 when all are
|
prints one line per invalid document to stderr, and exits 0 when all are
|
||||||
valid, 1 when one is not, and 2 on a usage or read failure. Install it with
|
valid, 1 when one is not, and 2 on a usage or read failure. Install it with
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# interpres.
|
# interpres.
|
||||||
#
|
#
|
||||||
# Everything below the variable block is the standard recipe set from the `justfile`
|
# Everything below the variable block is the standard recipe set, identical in
|
||||||
# skill, identical in every repository; project values live in the variable block only.
|
# every repository; project values live in the variable block only.
|
||||||
binary := "interpres-decode"
|
binary := "interpres-decode"
|
||||||
package := "./cmd/interpres-decode"
|
package := "./cmd/interpres-decode"
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ cross:
|
|||||||
example:
|
example:
|
||||||
go run ./examples/basic
|
go run ./examples/basic
|
||||||
|
|
||||||
# The release pre-flight from the release skill, in one command: the branch, a clean tree, a sync with origin, the gates, and a CHANGELOG section ready to release. Not a gate, it is the checklist before a release may even be discussed.
|
# The release pre-flight, in one command: the branch, a clean tree, a sync with origin, the gates, and a CHANGELOG section ready to release. Not a gate, it is the checklist before a release may even be discussed.
|
||||||
release-check version:
|
release-check version:
|
||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
my ($version) = @ARGV;
|
my ($version) = @ARGV;
|
||||||
|
|||||||
Reference in New Issue
Block a user