Skip to content

No way of skipping a field when marshaling #443

Description

@lzap

Hello, I need my custom MarshalTOML method to be able to omit a field completely when it is set to nil but it does not appear to be possible. It must not return. nil, nil that is an error, there is no special error value for omitting a field, returning an empty buffer creates an invalid TOML:

# this is not valid
field_that_needs_to_be_omitted = 

My type implements the Go 1.24 newly added IsZero() method but I guess that is something that is not supported in this library. That could be perhaps a solution.

Is there a solution? I do not have access to the script that encapsulates the type. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions