-
Notifications
You must be signed in to change notification settings - Fork 52
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
Validate zero modules #324
Conversation
Adds two private functions in 'internal/module_config': - func (cfg ModuleConfig) collectMissing() []string - func findMissing(reflect.Value, string, string, []string) These are unexported functions that aid in introspecting a datastructure to see if it has all its expected data. These functions are implicitly invoked via: - func LoadModuleConfig(string) (ModuleConfig, error) If there are errors then the program aborts with appropriate output.
func LoadModuleConfig(filePath string) (ModuleConfig, error) { | ||
config := ModuleConfig{} | ||
|
||
var required = []string{} | ||
fmt.Printf("%+#v\n", required) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is not needed anymore? since we're treating non-omitempty as required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, for sure! Thanks.
// If the value of the current node is equal to the zero value for its datatype | ||
// and its struct field does *not* have a "omitempty" value, then we assume it | ||
// is missing and add it to the resultset. | ||
func findMissing(obj reflect.Value, path, metadata string, missing *[]string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕶️ 👍
Adds two private functions in 'internal/module_config':
These are unexported functions that aid in introspecting a datastructure to see if it has all its expected data.
These functions are implicitly invoked via:
If there are errors then the program aborts with appropriate output.