Skip to content
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

fix(generator): support nil returns when using interface typed params #835

Conversation

jfragosoperez
Copy link
Contributor

@jfragosoperez jfragosoperez commented Oct 28, 2024

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Version of Go used when building/testing:

  • 1.22
  • 1.23

How Has This Been Tested?

  • Added test coverage
  • Regenerate test mocks to reflect the changes (NOTE: interface{} renamed to any by default for new golang versions)
task mocks
task test

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@LandonTClipp
Copy link
Collaborator

Thank you for the PR, this is on my radar so I will give it a review once I find some spare time... hopefully very soon 👍🏻

@jfragosoperez
Copy link
Contributor Author

@LandonTClipp cool, I'll wait for your news, in case any changes were required, I'll apply them ASAP. Thanks

Copy link
Collaborator

@LandonTClipp LandonTClipp left a comment

Choose a reason for hiding this comment

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

Ah, a simple fix! Thank you. One comment about the test.

pkg/generator_test.go Outdated Show resolved Hide resolved
@jfragosoperez jfragosoperez force-pushed the fix/support-for-interface-typed-params branch from f81e47f to d5632ca Compare November 9, 2024 01:04
Copy link
Collaborator

@LandonTClipp LandonTClipp left a comment

Choose a reason for hiding this comment

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

Wonderful, thank you!

@jfragosoperez jfragosoperez force-pushed the fix/support-for-interface-typed-params branch from d5632ca to 252ef3c Compare November 13, 2024 20:06
As referenced on vektra#513
Types using generic typed interface params, should allow nil values on return
@jfragosoperez jfragosoperez force-pushed the fix/support-for-interface-typed-params branch from 252ef3c to 6c7fb6b Compare November 13, 2024 20:08
@jfragosoperez
Copy link
Contributor Author

jfragosoperez commented Nov 13, 2024

@LandonTClipp I rebased and squashed into a single commit, so you're able to merge (the workflow will need to run first though)

@LandonTClipp LandonTClipp merged commit f6ecb44 into vektra:master Nov 14, 2024
4 checks passed
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.

Bug: Cannot return nil for generic type T, when T is an interface
2 participants