feat: typed decode and encode errors with the key path
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- `DecodeError` and `EncodeError`: decode and encode failures are wrapped in
|
||||
typed errors carrying the key path, read with `errors.AsType` instead of
|
||||
parsing the message text. The rendered messages keep their shape; the only
|
||||
visible change is that an encode failure on a top-level field no longer
|
||||
gains a meaningless leading dot in its path.
|
||||
- `omitzero` and `omitempty` tag options on encode: `toml:"name,omitzero"`
|
||||
skips a field whose value is the zero value of its type (a type with an
|
||||
`IsZero() bool` method decides through the method), and
|
||||
|
||||
Reference in New Issue
Block a user