-
Notifications
You must be signed in to change notification settings - Fork 0
generator: implement generator for builtin go types #3
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
generator: implement generator for builtin go types #3
Conversation
d1b999f
to
25d23bb
Compare
Pull Request Test Coverage Report for Build 17094978647Details
💛 - Coveralls |
b3efea9
to
9db06ac
Compare
9db06ac
to
afaf510
Compare
afaf510
to
0241968
Compare
d2b5880
to
8229f0d
Compare
8229f0d
to
217f1d6
Compare
217f1d6
to
b25e25f
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.
Please, update the commit message:
Closes TNTP-3729.
-> Closes TNTP-3729
b25e25f
to
242d515
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 implements a generator for builtin Go optional types with MessagePack serialization support. The generator produces optional types for int*, uint*, float*, bytes, string, bool, and byte with comprehensive test coverage for all methods including encoding/decoding roundtrip tests.
- Introduces a template-based code generator that creates consistent optional type implementations
- Adds complete MessagePack serialization/deserialization support with proper error handling
- Provides comprehensive test coverage for all generated optional types
Reviewed Changes
Copilot reviewed 41 out of 42 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
go.mod | Updated Go version and added dependencies for msgpack, testify, and text processing |
generate.go | Added go:generate directive for code generation |
cmd/generator/generator.go | Core generator implementation with templates for optional types and tests |
zero.go | Helper function for generic zero value initialization |
msgpack.go | MessagePack encoding/decoding utilities with type checking |
errors.go | Custom error types for encode/decode operations |
*_gen.go | Generated optional type implementations (byte, int*, uint*, float*, string, bytes, bool) |
*_gen_test.go | Generated comprehensive tests for all optional types |
errors_test.go | Unit tests for error handling functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
242d515
to
8b695f8
Compare
8b695f8
to
45b6455
Compare
|
return out | ||
} | ||
|
||
var defaultTypes = []generatorDef{ |
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.
Question: Would it make sense to move the contents of this array to a separate json | yaml
file and specify it as an argument for the generator?
Perhaps this will allow the generator to be reused in other projects for custom data types?
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.
This code will be optimized for client usage, when TNTP-3734 will be implemented.
* supported optional types are int*, uint*, float*, bytes, string, bool * fully redo configuration for golangci-lint * simple tests for encoding/decoding roundtrip Closes #TNTP-3729
45b6455
to
36c2684
Compare
Closes TNTP-3729.