Closed mpetronic closed 2 years ago
I am continuing to try to figure this out as I wait for some help. FWIW, I am running on Windows 10 in WSL2. I happen to also have a AlmaLinux 8 VM workstation at work and go 17.6. I tried this test there and everything works as expected for both #1 and #2 observed issues. There no differences between the two based on go env
output and VSCode is out of the loop as I am trying everything from the command line.
Solved. I found that there was a version of mockgen installed in /usr/bin/mockgen with references to some 1.12 go libraries in the binary (strings /usr/bin/mockgen). I had removed mockgen from my normal GOPATH - not recall why - and like got distracted and did not "go install" it again. But, since the old version of mockgen was in my PATH, it got picked up and the mystery began until I just now realized - WAIT! Why is which mockgen
showing /usr/bin/mockgen? I deleted that version and "go installed" the latest and all is well now. The joys of computers. :)
The actual behavior I am expecting is normal mock generation from my interface files using either
go generate
or directly callingmockgen
- neither is working correctly now - but used to work. I have not generated mocks in awhile so clearly something changed in my setup (I am assuming) that is causing these errors. I am stumped to understand what that is so I am reaching out and would greatly appreciate some help in understanding what is happening.There are two issues that I am seeing:
Here is the most simple test case I can contrive to consistently reproduce the error. The inline comments explain how to recreate:
With the IReader interface code uncommented, I get the following errors (see attached for full error log). I also get errors when:
/usr/local/go/src/runtime/proc.go:5664:23: invalid operation: shift count (id % 32) (value of type int32) must be unsigned integer /usr/local/go/src/runtime/proc.go:5657:23: invalid operation: shift count (id % 32) (value of type int32) must be unsigned integer /usr/local/go/src/runtime/panic.go:826:20: invalid operation: shift count i (variable of type int) must be unsigned integer /usr/local/go/src/runtime/panic.go:848:34: invalid operation: shift count i (variable of type int) must be unsigned integer /usr/local/go/src/runtime/panic.go:796:26: invalid operation: shift count shift (variable of type int) must be unsigned integer /usr/local/go/src/runtime/panic.go:798:31: invalid operation: shift count shift (variable of type int) must be unsigned integer /usr/local/go/src/runtime/mpallocbits.go:172:9: invalid operation: shift count sys.TrailingZeros64(x) & 63 (value of type int) must be unsigned integer <--------- SNIP ---------->