-
Notifications
You must be signed in to change notification settings - Fork 0
optional: implemented new generic type for optional types #4
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
e5353be
to
12d99f7
Compare
Pull Request Test Coverage Report for Build 17075268241Details
💛 - Coveralls |
12d99f7
to
5f1f147
Compare
interface.go
Outdated
"github.com/vmihailenco/msgpack/v5" | ||
) | ||
|
||
type genericInterface[T any] 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.
It looks like optionInterface
or commonInterface
since it is a common interface for the package types.
Please, add a short-comment description to the type: why do we need the interface? Since it is not obvious for a code reader.
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
5f1f147
to
93b0c20
Compare
* Implemented new generic option.Generic[T] type for safe and fast optional value handling. * Modified golangci-lint to ignore some irrelevant checks for tests and fixed error in exception configuration Closes #TNTP-3730
93b0c20
to
1cad82b
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 new generic Generic[T]
type for safe optional value handling in Go, providing type-safe alternatives to nil pointers and sentinel values. The implementation includes comprehensive MessagePack serialization support and maintains compatibility with existing generated types.
- Introduces
Generic[T]
type with standard optional methods (Some, None, IsSome, Get, etc.) - Adds interface compliance assertions to ensure all generated types implement the common interface
- Updates documentation and golangci-lint configuration for better test handling
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
generic.go | Core implementation of the new Generic[T] type with MessagePack support |
interface.go | Defines the common interface that all optional types must implement |
generic_test.go | Comprehensive test coverage for the new Generic[T] functionality |
*_gen.go | Adds interface compliance assertions to all generated optional types |
errors.go | Extends error handling to support Generic[T] encode/decode operations |
errors_test.go | Test coverage for new Generic[T] error handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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!
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!
Closes #TNTP-3730