megaease / easeprobe

A simple, standalone, and lightweight tool that can do health/status checking, written in Go.
Apache License 2.0
2.18k stars 231 forks source link

Find an alternative solution for bou.ke/monkey #519

Closed samanhappy closed 2 months ago

samanhappy commented 6 months ago

Currently, all tests will fail with the following log:

# bou.ke/monkey
Error: ../../../go/pkg/mod/bou.ke/monkey@v1.0.2/replace.go:24:14: undefined: jmpToFunctionValue

This seems to be related to the library's implementation on Mac M1. The bou.ke/monkey library has been archived for a long time and has license restrictions as mentioned in this issue.

I've found an alternative library, gomonkey, but there seems to be some API incompatibilities like Patch, UnpatchAll, etc.

Any suggestions @suchen-sci ?

suchen-sci commented 6 months ago

This problem has existed for a long time, and it's unfortunate that bou.ke/monkey does not work on Mac M1. If gomonkey works on all chips and offers all the functionality we need, we might consider using it. However, this change would be significant; a lot of code would need to be updated in this case.

Or we can fork the bou.ke/monkey and fix that problem on mac M1?

samanhappy commented 6 months ago

Fortunately, I came across another monkey library, derived from bou.ke/monkey.

However, there are still some incompatibilities with this library, such as the removal of PatchInstanceMethod. I've submitted an issue requesting the restoration of the PatchInstanceMethod method.

Perhaps we should wait for their response before deciding whether to fork and fix the issue.

samanhappy commented 6 months ago

Summary:

  1. The bou.ke/monkey library is only compatible with the amd64 architecture.
  2. The macos:latest runner corresponds to macOS-14-arm64.

Given these points, we have two options:

  1. Seek an alternative to bou.ke/monkey that supports arm64, which needs extra coding and testing work.
  2. Use an amd64-based runner like macos-13, which is a straightforward change but may not align with the release cycle of easeprobe.

What are your opinions, @suchen-sci?

suchen-sci commented 6 months ago

Well, I thought you were using a Mac M1... If it doesn’t affect your work, I would prefer the second option. Could we also add another build.yaml to the GitHub Actions to ensure that Easeprobe can be built on the latest Mac version?

What do you think? Additionally, could we update it when github.com/go-kiss/monkey is ready?

samanhappy commented 6 months ago

Great idea! Let's fix it quickly and keep an eye on the progress on github.com/go-kiss/monkey.