-
Notifications
You must be signed in to change notification settings - Fork 7
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
chore: group declarations when printing module #1133
Conversation
c2d2cd7
to
386d487
Compare
backend/schema/module.go
Outdated
|
||
// print decls in groups | ||
groupedTypes := []struct { | ||
types []interface{} |
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.
s/interface{}/any/g
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.
@alecthomas do you know if this is "lintable" It might be a good check for the other TBD team as well. :)
|
||
hasPrintedDecl = true | ||
hasPrintedDeclInGroup = true | ||
} |
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.
Declarations should already be sorted in the correct order, so you could simplify this considerably by just iterating over them and printing the correct spacing as you transition between groups/lines.
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.
Updated to trust the exisiting order, and use reflect.Type
rather than empty structs which makes it easier to access rules from the mapping
# Conflicts: # backend/schema/module.go
Nice! |
#1089
Ordering and spacing is the following (example has 2 of each declaration type)
Full example: