maxbrunsfeld / counterfeiter

A tool for generating self-contained, type-safe test doubles in go
MIT License
931 stars 90 forks source link

Support Go 1.22 #271

Closed stefanb closed 6 months ago

stefanb commented 6 months ago

When trying Go 1.22 rc1 in

the test failed:

==> Testing counterfeiter
==> /opt/homebrew/Cellar/counterfeiter/6.7.0/bin/counterfeiter -p os 2>&1
Writing `Os` to `osshim/os.go`... panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1028c9640]

Could you please check counterfeiter works with Go 1.22 and its prereleases?

joefitzgerald commented 6 months ago

Issue confirmed, and fixed in the latest version of counterfeiter (v6.8.1):

~/p/counterfeiter ❯❯❯ rm -rf ~/go/bin/counterfeiter
~/p/counterfeiter ❯❯❯ go1.22rc1 install github.com/maxbrunsfeld/counterfeiter/v6@latest
~/p/counterfeiter ❯❯❯ which -a counterfeiter
/Users/joe/go/bin/counterfeiter
~/p/counterfeiter ❯❯❯ counterfeiter -p os
Writing `Os` to `osshim/os.go`... Done
~/p/counterfeiter ❯❯❯ rm -rf ~/go/bin/counterfeiter
~/p/counterfeiter ❯❯❯ go1.22rc1 install github.com/maxbrunsfeld/counterfeiter/v6@v6.7.0
~/p/counterfeiter ❯❯❯ counterfeiter -p os
Writing `Os` to `osshim/os.go`... panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1022955c0]