Comments (2)
Thank you for the feedback,. I agree that eager checking of the config struct would be a desirable feature, but I think the actual possibility of an error is rather hypothetical, making it low priority. Another thing to consider is that some people may be making use of the fact that struct checking is not eager, and include ancillary fields in their config structs, which currently works without issue (even though this is not the originally intended usage of gcfg). Based on this, rather than changing the behavior of the existing gcfg.Read* APIs to panic more eagerly, it seems more pragmatic to add a new optional and explicit API, such as gcfg.MustStruct, that checks a config struct and panics if invalid.
from gcfg.
Regarding adding new APIs to support new behavior, have you considered using a variadic options pattern as described here so that you wouldn't need to add new variants of ReadInto, ReadStringInto, and ReadFileInto every time there's a new option? Either that, or a single new API variant of each that takes an options struct.
from gcfg.
Related Issues (13)
- Please clarify license HOT 1
- include section/field in error HOT 1
- string processing incomplete HOT 2
- Escaped characters in unquoted values HOT 1
- Allow custom deserialization with callbacks HOT 2
- Test error with Golang 1.13: strconv.ParseInt: parsing "0x": invalid syntax HOT 2
- Re-serialisation maintaining comments and whitespace HOT 1
- Does not support underscore HOT 1
- Can one override configuration setting with environment variable? HOT 1
- How should one parse an Amazon go sdk configuration file containing underscores? HOT 2
- default values with subsections HOT 5
- user-provided variables (branch feature/user_vars) -- vote for inclusion in master HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gcfg.