Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nullable types for configuration values #621

Open
imiric opened this issue Nov 1, 2022 · 0 comments
Open

Use nullable types for configuration values #621

imiric opened this issue Nov 1, 2022 · 0 comments
Labels
feature A new feature

Comments

@imiric
Copy link
Contributor

imiric commented Nov 1, 2022

Feature Description

There are many cases where it's important to distinguish between an empty/unset value and a set value that happens to be empty. This is particularly important for configuration, where the user might intentionally set a boolean to false, or an integer to 0, yet since these are default zero values in Go, we can't make that distinction. Knowing this is important for validation, as in some cases e.g. nil might not be a valid value, but it might be in others.

This is the reason most k6 options use nullable values, and while we shouldn't adopt many things from k6 configuration (grafana/k6#883 😅), I think this could be one of them. At least until croconf is ready for use, which should solve all our problems:tm:.

Suggested Solution (optional)

https://github.com/guregu/null seems to be the de facto standard library for this, though we might want to do some research if there are any reasonable alternatives.

Note that k6 itself defines some additional null types that are not found in guregu/null, that we might want to use.

Already existing or connected issues / PRs (optional)

#611

@imiric imiric added the feature A new feature label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

No branches or pull requests

1 participant