fix(encode): reject a nil MarshalTOML result
Assisted-by: GLM 5.3
This commit is contained in:
+4
-1
@@ -309,7 +309,10 @@ The returned value is encoded as if it had been passed in place of the
|
||||
receiver, so it may be a scalar, a slice, an array of tables, or another
|
||||
struct or map, including the `Marshaler` result of another type; the encoder
|
||||
recurses. An error returned from `MarshalTOML` fails the marshal wrapped with
|
||||
the key path, for example `interpres: server.port: bad timestamp`.
|
||||
the key path, for example `interpres: server.port: bad timestamp`. A result
|
||||
of `nil` with a nil error fails the same way with
|
||||
`MarshalTOML returned a nil value`: nil has no TOML representation, so
|
||||
dropping the field silently is not an option.
|
||||
|
||||
```go
|
||||
type Port int
|
||||
|
||||
Reference in New Issue
Block a user