-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: check for duplicate configs and secrets within a module #1328
Conversation
The original issue was just about preventing duplicates in the schema, not necessarily in the code. I think this makes sense though, as it's a bit of a code smell to redeclare something in multiple locations. |
go-runtime/compile/schema.go
Outdated
for _, d := range pctx.module.Decls { | ||
c, ok := d.(*schema.Config) | ||
if ok && c.Name == name && c.Type.String() == st.String() { | ||
pctx.errors.add(errorf(node, "duplicate config declaration")) |
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.
Let's report the location of the other declaration in the message (here and below).
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.
great idea - done
You'll need to roll this out to the PFI repo, which will be ... interesting. |
Notes to self (and anyone curious :) )
|
Don't delay merges, just get them in. |
Got it, sounds good! I'll merge this to start (once everything passes) and get the rest of it done in a following PR. I'll move my TODOs to the issue for better tracking. |
Contributes to one part of #1121