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
mockery v2.10.0 cannot generate file on go1.18 #434
Comments
Having the same issue with 1.18 |
Having similar issue with the error message Go Version: 1.18 |
yes, Having the same issue with 1.18 internal error: package "context" without types was imported from .... |
update to mockery version: v2.10.0 is ok |
Having a similar issue with Go 1.18: Adding |
Without the additional `NeedDeps` mockery fails with: "Unexpected package creation during export data loading" Refs vektra#434
Has similar issue with system version overriding user version of mockery which mockery
/usr/local/bin/mockery rm /usr/local/bin/mockery go install github.com/vektra/mockery/v2@latest which mockery
/Users/{username}/go/bin/mockery mockery worked again after running this |
This is a bit confusing... The binary downloaded from https://github.com/vektra/mockery/releases/tag/v2.10.0 (darwin_arm64) reports an error:
But running
Both report the same version, was the release built from the wrong tag? |
The release is presumably built with Go 1.17, while |
Sadly 1.10.1 does not fix this issue. The release 2.10.1 seems to be built with go 1.16.14: ➜ go version -m ~/Downloads/mockery_2.10.1_Darwin_arm64/mockery
/Users/claus/Downloads/mockery_2.10.1_Darwin_arm64/mockery: go1.16.14
... Running mockery in a folder with this simple test file does not work: package tmp
import "sync"
func stuff() {
var m sync.Map
m.Range(func(key interface{}, value interface{}) bool {
return false
})
} ➜ ~/Downloads/mockery_2.10.1_Darwin_arm64/mockery --all
31 Mar 22 10:51 CEST INF Starting mockery dry-run=false version=v2.10.1
31 Mar 22 10:51 CEST INF Walking dry-run=false version=v2.10.1
31 Mar 22 10:51 CEST ERR Error parsing file error="/Users/claus/ext_src/mockery/tmp/test.go:7:10: cannot use (func(key interface{}, value interface{}) bool literal) (value of type func(key interface{}, value interface{}) bool) as func(key invalid type, value invalid type) bool value in argument to m.Range" dry-run=false version=v2.10.1 While running a version manually built with go1.18 works: ➜ go version -m ../mockery
../mockery: go1.18
... ➜ ../mockery --all
31 Mar 22 10:51 CEST INF Starting mockery dry-run=false version=v0.0.0-dev
31 Mar 22 10:51 CEST INF Walking dry-run=false version=v0.0.0-dev
# (Exits with code 0) |
fix: golang build version 1.18 (issue #434)
How to reproduce
mockery version: v2.10.0
env: go 1.18
demo repo: https://github.com/sgreben/testing-with-gomock
output:
❯ mockery --dir=doer --name=Doer
16 Mar 22 10:48 AEDT INF Starting mockery dry-run=false version=v2.10.0
16 Mar 22 10:48 AEDT INF Walking dry-run=false version=v2.10.0
16 Mar 22 10:48 AEDT FTL Unable to find 'Doer' in any go files under this path dry-run=false version=v2.10.0
Other bugs
in a larger private repo,
internal error
2022/03/16 10:50:38 internal error: package "net/http" without types was imported from "xxx"
Possible reason
when downgrade to
go1.16.15
it works for my larger scale project but failed on that demo repo up thereso it's a positive feedback
The text was updated successfully, but these errors were encountered: