Open jcburley opened 5 months ago
I think it would be worthwhile for you do post a few things here:
.mockery.yaml
file (if any)--log-level debug
I would recommend clearing your entire Go cache on your Jenkins server. This really smells to me like you have some incompatibility with a cached package and the Go version being used in mockery. In my professional experience when encountering issues like this, this tends to fix it.
Thanks @LandonTClipp — I'll try to get to that soon, as I believe you're correct that our base Golang Docker image might have a corrupt cache, since adding go clean -modcache
to our package's Jenkins pipeline, just before building, made the issue disappear, just as happened on my laptop.
Mockery sometimes generates bad code (in the form of a package import), but running
go clean -modcache
and rebuilding seems to have fixed it on my laptop; yet the problem also repeatedly occurs when running our build using Docker in a Jenkins CI. (Perhaps our Golang image isn't starting out with a clean modcache?)Mockery was generating this code:
In both Docker and, earlier at least, on my laptop, numerous errors were shown regarding "could not import ... (no metadata for ...)", including for the
context
package in std.But the following subsequent errors really stand out and suggest something weird is going on in parsing, which might be leading to the
command-line-arguments
error shown above:Upgrading to Go 1.21.5 and Mockery 2.39.1 doesn't seem to have resolved these issues. And I can't find any salient occurrences of the string
command-line-arguments
in our source (including vendor code), in Mockery, or even in the Go source tree.Is this worth investigating further?
golangci-lint
does show some vanilla lint issues (no obvious problems parsing the source code), andgo test -v ./...
actually passes all the tests (there aren't any in the generatedmock*
directories, of course), so it's not noticing any problems with the source code.If necessary, I can try to gather all the info on versions and such, but first wanted to see if anyone recognized the above and could recommend a course of action.
In the meantime, I'll at least fix the lint issues to get a clean run, just in case that helps spot some issue.
Thanks, and apologies for the vague/weird Issue lacking (so far) a repro.