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

Release v2.10.1 hangs on Starting mockery dry-run=false version=v2.10.1 #442

Closed
dillonstreator opened this issue Mar 31, 2022 · 18 comments
Closed

Comments

@dillonstreator
Copy link
Contributor

Noted when running mockery --all --inpackage --case snake

@dillonstreator
Copy link
Contributor Author

resolved for now by pinning previous version
go install github.com/vektra/mockery/v2@v2.10.0

@LandonTClipp
Copy link
Contributor

I think I know where this might be coming from. My suspicion isn't that it's hanging, but that it's taking a lot longer than normal. Probably from this: 4e181be

Please try v2.10.2, if that does work I will revert the above commit.

@Tochemey
Copy link

Tochemey commented Apr 1, 2022

Yeah I have observed it takes longer than before to generate the mocks.
image

@Tochemey
Copy link

Tochemey commented Apr 1, 2022

At times it does hang even the lastest release. I think this is not stable. @LandonTClipp might have to reverse the changes because this may cause some panic

@taylow
Copy link

taylow commented Apr 2, 2022

I am having the same issue on darwin/arm64 (Apple M1) running mockery --all --keeptree and have noticed the memory usage just keeps growing.

image

@ludusrusso-rc
Copy link

Same here

@LandonTClipp
Copy link
Contributor

LandonTClipp commented Apr 7, 2022

Folks can you try the latest release, I have reverted a change that I believed was causing the runtime issue, although we may have introduced some other bug. @emmanuel099 is showing a list of versions that work: #444

@taylow
Copy link

taylow commented Apr 8, 2022

Just installed 2.10.4 and have a new issue, is there a known fix for this error?

image

@LandonTClipp
Copy link
Contributor

@taylow could you provide a reproducer for this issue?

@taylow
Copy link

taylow commented Apr 11, 2022

@LandonTClipp happy to provide as much info as I can!

My current setup is:

  • go version go1.18 darwin/arm64
  • Mockery version v2.10.4 installed via Brew
  • I'm using an M1 Mac darwin/arm64
  • I'm running the command make mocks via a Makefile, which calls mockery --all --keeptree
  • I currently have Mocks that are outdated which need regenerating

If there is anything else you need/could help here please let me know!

@LandonTClipp
Copy link
Contributor

Thanks @taylow . Could you provide a reproducible example of this error happening? We have various matrix testing for Go versions and OS environments which haven't caught this, so I would love to fix this issue if we can isolate where it's coming from.

@taylow
Copy link

taylow commented Apr 12, 2022

@LandonTClipp, after lots of checking out and generating mocks, we managed to narrow it down to a generic package we use called Lo.

The following code will reproduce the error:

package bugged

import (
	"github.com/samber/lo"
)

func Bugged() {
	test := []string{"aaa", "bbb", "ccc"}
	lo.Contains(test, "test")
}

@taylow
Copy link

taylow commented Apr 12, 2022

Simply importing the package causes the same error

import _ "github.com/samber/lo"

@LandonTClipp
Copy link
Contributor

I see, thanks for the information @taylow . Unfortunately, mockery is incompatible with Golang 1.18 features so you will have to pin your dependencies on versions that don't use generics. I do plan to add support for generics, however PRs to do this are more than welcome and will speed up the whole process.

@emmanuel099
Copy link
Contributor

Building mockery v2.10.4 with replace golang.org/x/tools => github.com/reillywatson/tools v0.1.10-0.20220322163840-50e5cab0be89 fixes the Unexpected package creation during export data loading problem for me.

See golang/go#51629 (comment)

@emmanuel099
Copy link
Contributor

@LandonTClipp I think that we have two different issues. Mockery cannot create mocks for interfaces with generics vs. mockery fails because of generics unrelated to the mocked interface. The first issue requires additional code in mockery, whereas the second is definitely a bug IMHO:

package test

import _ "github.com/samber/lo" // mock generation works without this line

type Requester interface {
	Get(path string) (string, error)
}

This bug can either be fixed by adding packages.NeedDeps which introduces serve performance and memory problems, or by reillywatson/tools@50e5cab which hopefully lands in x/tools soon.

@LandonTClipp
Copy link
Contributor

Closing this issue, please let me know if anyone is having any further issues.

@mikegleasonjr
Copy link

Still have the Unexpected package creation during export data loading on v2.15.0 from time to time

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

No branches or pull requests

7 participants