-
Notifications
You must be signed in to change notification settings - Fork 423
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
Go 1.24 compatibility / package "context" without types was imported
error
#914
Comments
Having the same issue with go 1.24 |
Thanks for the report. I'll have to look into this, usually these problems are environmental and involve stale cached packages, but since you said you already cleaned the cache and are still encountering the problems, there might be something novel going on. Can you provide more details on your running environment:
This project also does not yet officially support 1.24 as you can see the go.mod file is at 1.23 and 1.24 is not in the testing matrix yet. I just need to spend some time to bringing it up to spec. |
Sure
Failure is also reproducible on github actions when running mockery |
As requested:
(also occurring in our self-hosted GHA runners on arm64 / debian 22.04)
Totally understood, and thanks! |
I reproduced the problem in CI: https://github.com/vektra/mockery/actions/runs/13278535376/job/37072470870?pr=915 Added support for 1.24 in #915. You can see after I add 1.24 in go.mod, the type errors go away. I don't know exactly why this happens, but the Go language introduced generic constraints on type aliases in golang/go#46477, which I believe will cause the typing information as compiled to be incompatible with older versions. This shouldn't happen because ostensibly the Go compiler is capable of handling cases like this, and this is a clear backwards incompatibility (assuming this project is not actually doing anything wrong). If anyone could help me figure out why exactly this happens and how to prevent it in future releases, I'd be eternally grateful. |
Interestingly, I cannot reproduce this on my local env:
It compiles just fine. Anyway, let me know if v2.52.2 fixes the issue for you. |
Oops, I got the right answer, but for the wrong reason. The problem appears to have been resolved by upgrading the |
Thanks, the update fixed it. The issue can now be closed |
Thanks for the expedient update here! |
Seeing an error generating mocks with Go 1.24.0
where the import is more-or-less just
It looks like this has been a common issue in the past with new Go versions, and running through the cache clearing steps referred to in https://vektra.github.io/mockery/v2.35/notes/#internal-error-package-without-types-was-imported didn't appear to help so I figured I'd flag this in case it's an actual issue w/ 1.24.0
Thanks!
The text was updated successfully, but these errors were encountered: