macosGO本地运行MonkeyPatch [操作系统入门]
1.Macos本地无法使用monkeyPatch调试的原因
引用一段原文,意思是,操作系统不能通过对一个内存页执行写和执行的操作。(Linux似乎没有这个问题)
(Monkey won‘t work on some security-oriented operating system that don‘t allow memory pages to be both write and execute at the same time. With the current approach there‘s not really a reliable fix for this.)来源:https://github.com/bouk/monkey
2.Macos本地运行monkeyPatch方法(使用docker)
docker中运行测试。将本地 $GOPATH 映射到docker的/root/gopath中。进入项目测试用例目录运行 go test 执行测试用例。
docker run -d -it --name gotest --env GOFLAGS="-mod=vendor" --env GOPATH=/root/gopath --mount type=bind,source=$GOPATH,target=/root/gopath golang:1.13
macos GO本地运行MonkeyPatch
以上是 macosGO本地运行MonkeyPatch [操作系统入门] 的全部内容, 来源链接: utcz.com/z/518531.html