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

Bugs/improvements on union interfaces, diff displaying and version setting #102

Merged
merged 11 commits into from
May 11, 2024

Conversation

zcolleen
Copy link
Collaborator

@zcolleen zcolleen commented May 2, 2024

In this pr i introduce 3 bugs/improvements:

  1. We have to update gowrap when pr Support of union and type approximation in generics hexdigest/gowrap#86 is merged, to fix generation of interfaces with unions and type approximations.

  2. Improvement with diff displaying: when test fails because expectations failed and we used minimock.Anycontext, the diff will show arguments that are different as well as context argument, e.g.

        Diff:
        --- Expected params
        +++ Actual params
        @@ -1,6 +1,4 @@
         (tests.ContextAccepterMockAcceptContextWithOtherArgsParams) {
        - ctx: (minimock.anyContext) {
        -  Context: (context.Context) <nil>
        - },
        - i1: (int) 24
        + ctx: (context.backgroundCtx) context.Background,
        + i1: (int) 123
         }

It is very confusing for developers as they think that there is also some issue with context, that anyContext is not working. So i improved diff displaying in that way that it wont show difference between context if anyContext is used, e.g.

        Diff:
        --- Expected params
        +++ Actual params
        @@ -4,3 +4,3 @@
          },
        - i1: (int) 24
        + i1: (int) 123
         }
  1. Improved version when displaying --version or setting it in generated code. The issue is that if you install minimock binary with go install, the version is set to 'dev', so in generated code minimock version is set to 'dev' making it impossible to understand which version of minimock has generated code, e.g.
// Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT.

So in this pr if version is not set, we will take version and commit from debug.ReadBuildInfo() .

  1. Some minor documentation update.

@hexdigest
Copy link
Collaborator

Hey @zcolleen!

Thank you for the fix! I released v1.3.7 version of Gowrap, can you please update this pr (remove replace directive from go.mod).

@zcolleen
Copy link
Collaborator Author

zcolleen commented May 3, 2024

Hey @hexdigest ! Updated go.mod, double checked everything

@hexdigest hexdigest merged commit f204e2d into gojuno:master May 11, 2024
1 check 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.

2 participants