Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Is it even possible to submit an empty string as a config file/CLI-provided value? #46

@atc0005

Description

@atc0005

While preparing to duplicate an existing validation check like this one the thought hit me: Maybe it's not necessary to guard against empty strings as an input value from a user? It feels "wrong", but perhaps the config packages already have this responsibility?

// Verify that the user did not opt to set an empty string as the value,
// otherwise we fail the config validation by returning an error.
if c.IsSetIgnoredIPAddressesFile() && c.IgnoredIPAddressesFile() == "" {
    return fmt.Errorf("empty path to ignored ip addresses file provided")
}

For now I'm going ahead with duplicating the validation check, but it would be good to learn what the best practice for this is and apply it here (and elsewhere).

Metadata

Metadata

Assignees

Labels

configquestionFurther information is requested

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions