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

feat: Add option: 'required' by default #187

Merged
merged 2 commits into from Aug 10, 2021
Merged

feat: Add option: 'required' by default #187

merged 2 commits into from Aug 10, 2021

Conversation

bhallionOhbibi
Copy link
Contributor

Changes

  • Add a new option RequiredIfNoDef that mark all field ,required by default.

Why

In most of my projects, environement variables are either required or have default values.
Adding this option allow to remove a redundant (and sometimes obvious) ,required in field tags.

@bhallionOhbibi bhallionOhbibi changed the title Add option: 'required' by default feat: Add option: 'required' by default Aug 10, 2021
@caarlos0
Copy link
Owner

lgtm, but can you add a test for it as well?

@codecov
Copy link

codecov bot commented Aug 10, 2021

Codecov Report

Merging #187 (be171b4) into master (929e30e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #187   +/-   ##
=======================================
  Coverage   98.13%   98.14%           
=======================================
  Files           2        2           
  Lines         322      323    +1     
=======================================
+ Hits          316      317    +1     
  Misses          4        4           
  Partials        2        2           
Impacted Files Coverage Δ
env.go 98.10% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 929e30e...be171b4. Read the comment docs.

@bhallionOhbibi
Copy link
Contributor Author

Hi @caarlos0, thanks for your feedback.
I just added a test for this new option. (be171b4)

@caarlos0 caarlos0 merged commit 92ab404 into caarlos0:master Aug 10, 2021
@caarlos0
Copy link
Owner

Thanks!

nexoscp added a commit to nexoscp/env that referenced this pull request Apr 7, 2022
* feat: Add RequiredIfNoDef option to avoid redudant required paramter on fields

* test: add missing test for Option.RequiredIfNoDef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants