Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
samanhappy opened this issue May 6, 2024 · 5 comments
Open

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

samanhappy opened this issue May 6, 2024 · 5 comments
Assignees

Comments

@samanhappy
Copy link
Collaborator

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
Copy link
Contributor

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Contributor

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
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants