Adjusted error handling and moved flag.Var to tree.flagSet.Var#12
Merged
andreimerlescu merged 4 commits intomainfrom Jul 3, 2025
Merged
Adjusted error handling and moved flag.Var to tree.flagSet.Var#12andreimerlescu merged 4 commits intomainfrom
andreimerlescu merged 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors flag handling and error management by introducing custom error types and routing flag registrations through a figTree instance rather than the global flag package.
- Replace
fmt.Errorfcalls withErrInvalidValue,ErrConversion, andErrInvalidTypefor richer error types - Switch all
flag.Varinvocations in New… andWithAliasmethods totree.flagSet.Var - Add
Mutagenesis.Kind, consolidate and exposeMutagenesisOffunctions in a newmutagenesis.go
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| parsing.go | Use ErrInvalidValue instead of fmt.Errorf in error returns |
| mutations_new.go | Update flag.Var → tree.flagSet.Var in all New* definitions |
| mutagenesis.go | New file: Mutagenesis.Kind(), global & tree MutagenesisOf |
| loading.go | Reorder imports |
| errors.go | Define ErrInvalidType, ErrConversion, ErrInvalidValue |
| conversions.go | Replace default fmt.Errorf with ErrConversion |
| assure.go | Replace fmt.Errorf in validators with ErrInvalidType |
| alias.go | Change global flag.Var → tree.flagSet.Var for aliases |
Comments suppressed due to low confidence (1)
errors.go:34
- [nitpick] Using
%Tprints only the Go type ofe.Got, not its value. Consider using%vto include the actual value or adjust the message for clarity, e.g.,fmt.Sprintf("failed to convert %v (type %T) from %s to %s", e.Got, e.Got, e.From.Kind(), e.To.Kind()).
return fmt.Sprintf("failed to convert %T type %s into %s", e.Got, e.From.Kind(), e.To.Kind())
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.