-
Notifications
You must be signed in to change notification settings - Fork 0
generator: add optional type generator for user-defined MessagePack types #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
Conversation
49069c5
to
441f593
Compare
024b79e
to
e3d62f7
Compare
The commit message ideally should be short (<52 chars), so you need to update it:
->
|
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.
Thank you for the patch.
To be honest, it is unclear how to use this now and why it is needed.
Please add a description in the README.md for this generator and how to use it at this PR.
876c6af
to
a3418aa
Compare
@@ -0,0 +1,37 @@ | |||
package extractor |
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.
Please, test a public API only.
package extractor | |
package extractor_test |
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.
fixed
59ad5c5
to
dff22cb
Compare
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 adds infrastructure for generating optional wrapper types for custom types that implement MessagePack extension methods. It introduces a new CLI tool to generate code for specific types with configurable MessagePack extension codes and maintains compatibility with existing option package patterns.
- Adds
cmd/gentypes
CLI tool for generating optional types with MessagePack extension support - Implements code generation templates for both optional types and their corresponding tests
- Creates test infrastructure including the
FullMsgpackExtType
example with complete MessagePack serialization
Reviewed Changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
go.mod | Updates dependencies to support the new code generation tool |
cmd/gentypes/generator.go | Main CLI application for generating optional types |
cmd/gentypes/generator/extension.go | Core code generation logic and template execution |
cmd/gentypes/generator/type_gen.go.tpl | Template for generating optional type implementations |
cmd/gentypes/generator/type_gen_test.go.tpl | Template for generating comprehensive test suites |
cmd/gentypes/extractor/*.go | Package analysis and AST extraction utilities |
cmd/gentypes/test/*.go | Example implementation and generated test files |
README.md | Documentation for the new gentype utility |
.golangci.yml | Updated linter configuration for generator code paths |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
dff22cb
to
f19150d
Compare
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.
Looks like all dots in the right places.
Add infrastructure to generate optional wrapper types for custom types that implement MessagePack extension methods (MarshalMsgpack/UnmarshalMsgpack). Changes: * New CLI tool (cmd/gentypes) to generate code for specific types. * Support for MessagePack extension format with configurable extension codes. * Compatibility with existing option package patterns. * Updated linter exclusions for generator code paths. * Added import allow lists for new dependencies. Example usage: go run cmd/gentypes -ext-code 1 -package ./path/to/package TypeName Closes #TNTP-3734.
f19150d
to
22ee789
Compare
Add infrastructure to generate optional wrapper types for custom types that
implement MessagePack extension methods (MarshalMsgpack/UnmarshalMsgpack).
Changes:
Example usage:
go run cmd/gentypes -ext-code 1 -package ./path/to/package TypeName
Closes #TNTP-3734.