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

HasSection function proposal #271

Closed
bryanpedini opened this issue Nov 9, 2020 · 3 comments · Fixed by #308
Closed

HasSection function proposal #271

bryanpedini opened this issue Nov 9, 2020 · 3 comments · Fixed by #308
Labels
enhancement New feature or request

Comments

@bryanpedini
Copy link
Contributor

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
HasSection(string) (boolean, error) {} function, to be able to use "quick if statements" without needing to check if the section name is in cfg.Sections().

Describe alternatives you've considered
Check if section name is in the slice provided by cfg.Sections().

Additional context
None, I think.

@unknwon unknwon added the enhancement New feature or request label Nov 24, 2020
@unknwon
Copy link
Member

unknwon commented Nov 24, 2020

@bryanpedini Thanks for the feedback! Any reason why the method signature is not HasSection(string) bool (without error)?

@bryanpedini
Copy link
Contributor Author

bryanpedini commented Nov 24, 2020

Honestly dunno what I thought 2 weeks ago, was on a local shady proof of concept now deleted project that I can't currenlty remember anything about. 😅
It was probably about, if cfg.Sections() is empty, or if it throws an error itself down the line of function recursiveness, or something like that.

Honestly, if it works great even without the error, it's even better 'cause well, it doesn't throw errors...
If you're thinking of an implementation, please feel free to do it whatever way you like the most!

@bryanpedini
Copy link
Contributor Author

Hello, sorry for the ping.
Any news regarding #308 related to this FR?

@unknwon unknwon linked a pull request Nov 30, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants