Closed DustinJSilk closed 4 months ago
Excellent! I'll give it a proper review in a few days. Thanks for the contribution.
Attention: 82 lines
in your changes are missing coverage. Please review.
Comparison is base (
3b25f39
) 42.45067% compared to head (601d297
) 42.65889%. Report is 4 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey @LandonTClipp
These are the 2 new formats I'd propose for replacing generic types using the replace-type
option, please let me know what you think of the 2 examples below:
Replace a type parameter:
module.com/foo.Foo[T]=module.com/baz.Baz
type Foo[T any] struct {}
func (*Foo) Get() T {}
type Foo[T baz.Baz] struct {}
func (*Foo) Get() T {}
Remove a type parameter and set each instance of it:
module.com/foo.Foo[-T]=module.com/baz.Baz
type Foo[T any] struct {}
func (*Foo) Get() T {}
type Foo struct {}
func (*Foo) Get() baz.Baz {}
Hi @LandonTClipp
I've updated the API to the suggestion above which I'm using successfully for my usecase and hopefully it provides more flexibility for others.
I'm happy to change the API if you have any ideas.
Hi @DustinJSilk, apologies for the lack of responses the last few weeks. I have been on the hunt for a new job and I haven't been able to devote much time or energy to this project, but luckily my search is coming to a close (hopefully, knock on wood).
As far as your proposals, I think I'm on board with it. The only thing I'm unhappy about (which has nothing to do with your proposal or implementation) is that I don't enjoy these complex, custom parameter strings. I think in hindsight, I would have preferred replace-types
to simply be a list of maps with individual parameters, instead of having to parse this string here. That ship has already sailed... it's something I'll probably deprecate once a better implementation is available.
The tests are failing due to an unrelated bug that I will fix in a separate PR.
Good work @DustinJSilk, feature has been released.
Amazing thanks @LandonTClipp
Description
Adds a config option that can replace generic types with a concrete type.
Type of change
Version of Golang used when building/testing:
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist