-
Notifications
You must be signed in to change notification settings - Fork 17
update generated code to modern conventions #35
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
Conversation
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.
Pull Request Overview
This PR modernizes the code generation output to align with current Go conventions. The changes eliminate the deprecated +build directive syntax, relocate the generated code marker to appear before the package declaration (as recommended by Go standards), and fix a documentation comment to include the correct function name.
Key Changes:
- Removed
// +builddirectives in favor of//go:buildonly - Moved "Code generated by..." comment above package declaration
- Added proper function names to MaxSize() method comments
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| printer/print_test.go | Updated test expectation to match new build header format without +build directive |
| printer/print.go | Reordered package header generation to place generated code marker first and removed +build directive |
| gen/maxsize.go | Added function name extraction for MaxSize method comments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| if IsDangling(p) { | ||
| baseType := p.(*BaseElem).IdentName | ||
| s.p.comment(strings.TrimSuffix(getMaxSizeMethod(baseType), "()") + " returns a maximum valid message size for this message type") |
Copilot
AI
Nov 14, 2025
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.
The expression strings.TrimSuffix(getMaxSizeMethod(baseType), \"()\") is duplicated on lines 97 and 111. Consider extracting this into a helper function to improve maintainability and reduce code duplication.
jannotti
left a comment
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 don't understand the build tags things.
|
+build was deprecated in Go 1.17 and now things complain if you have it in there |
+builddirectivesCode generated by ...above package declaration