bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.35k stars 635 forks source link

Rules_go 0.47.0 downgraded the gomock dependency from 1.7.0-rc1 to 1.6.0, which broke support for generics in mocks #3930

Open andersbach-dp opened 2 months ago

andersbach-dp commented 2 months ago

What version of rules_go are you using?

0.47.0

What version of gazelle are you using?

0.36.0

What version of Bazel are you using?

6.5.0

Does this issue reproduce with the latest releases of all the above?

Mocks using generics are broken, as the gomock lib downgrade has no support for generics.

What operating system and processor architecture are you using?

Linux amd64, Darwin arm64

What did you do?

We have several mocks generated from cloud provider interfaces using generics, which with the latest rules_go fail as gomock 1.6.0 can not handle generics correctly.

What did you expect to see?

Mocks generated under rules_go 0.46.0 worked as expected.

What did you see instead?

A error message failed parsing returns: don't know how to parse type *ast.IndexExpr

fmeum commented 2 months ago

CC @tyler-french

@andersbach-dp You should be able to work around this by adding your own repository for gomock in WORKSPACE before invoking rules_go's dependency macro. In the mid- to long-term, I would strongly recommend switching to MODULE.bazel, which prevents issues like this thanks to proper version resolution.