Skip to content

Conversation

bigbes
Copy link
Collaborator

@bigbes bigbes commented Aug 19, 2025

  • 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

@bigbes bigbes requested a review from Copilot August 19, 2025 13:57
Copilot

This comment was marked as outdated.

@bigbes bigbes force-pushed the bigbes/TNTP-3730-generic-optional branch 2 times, most recently from e5353be to 12d99f7 Compare August 19, 2025 14:12
@coveralls
Copy link

coveralls commented Aug 19, 2025

Pull Request Test Coverage Report for Build 17075268241

Details

  • 1200 of 1312 (91.46%) changed or added relevant lines in 20 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+91.5%) to 91.463%

Changes Missing Coverage Covered Lines Changed/Added Lines %
bool_gen.go 60 66 90.91%
byte_gen.go 60 66 90.91%
bytes_gen.go 60 66 90.91%
float32_gen.go 60 66 90.91%
float64_gen.go 60 66 90.91%
int16_gen.go 60 66 90.91%
int32_gen.go 60 66 90.91%
int64_gen.go 60 66 90.91%
int8_gen.go 60 66 90.91%
int_gen.go 60 66 90.91%
Totals Coverage Status
Change from base Build 16726999280: 91.5%
Covered Lines: 1200
Relevant Lines: 1312

💛 - Coveralls

@bigbes bigbes requested a review from Copilot August 19, 2025 14:18
Copilot

This comment was marked as outdated.

@bigbes bigbes force-pushed the bigbes/TNTP-3730-generic-optional branch from 12d99f7 to 5f1f147 Compare August 19, 2025 16:06
interface.go Outdated
"github.com/vmihailenco/msgpack/v5"
)

type genericInterface[T any] interface {
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@bigbes bigbes force-pushed the bigbes/TNTP-3730-generic-optional branch from 5f1f147 to 93b0c20 Compare August 20, 2025 10:05
@bigbes bigbes marked this pull request as ready for review August 20, 2025 10:06
Copilot

This comment was marked as outdated.

* 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
@bigbes bigbes force-pushed the bigbes/TNTP-3730-generic-optional branch from 93b0c20 to 1cad82b Compare August 20, 2025 10:12
@bigbes bigbes requested a review from Copilot August 20, 2025 10:14
Copy link

@Copilot Copilot AI left a 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.

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a 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!

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a 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!

@bigbes bigbes merged commit 942b415 into master Aug 20, 2025
21 of 25 checks passed
@bigbes bigbes deleted the bigbes/TNTP-3730-generic-optional branch August 20, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants