Skip to content

Impossible to disable flags that default to 'true' #23

@l3k4n

Description

@l3k4n

For example in arigo.Options you have:

AutoFileRenaming              bool    `json:"auto-file-renaming,omitempty,string"`

This options default value is true and when it is set to false, the json serializer strips it out because it thinks it's empty. I believe this applies to basically all boolean options, making all default true options impossible to change.

This leaves one of 3 options:

  1. make a custom type for on/off type options and explicitly handle the 'empty' case
  2. make them all pointers
  3. just drop, the omitempty

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