agiledragon / agiledragon/gomonkey

panic: permission denied;go test ./main_test.go -gcflags=all=-l

未關閉
#113 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Go
星號
2.3k
分支
192
平均合併
1 天 6 小時
30 天內合併 PR
1

描述

goroutine 4 [running]:
testing.tRunner.func1.2({0x100bcf660, 0x100c89988})
/Users//.gvm/gos/go1.18.5/src/testing/testing.go:1389 +0x1c8
testing.tRunner.func1()
/Users//.gvm/gos/go1.18.5/src/testing/testing.go:1392 +0x384
panic({0x100bcf660, 0x100c89988})
/Users//.gvm/gos/go1.18.5/src/runtime/panic.go:838 +0x218
github.com/agiledragon/gomonkey/v2.modifyBinary(0x18?, {0x14000018108, 0x18, 0x8?})
/Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/modify_binary_darwin.go:9 +0xac
github.com/agiledragon/gomonkey/v2.replace(0x100bc3c60?, 0x100be5b78?)
/Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:269 +0x78
github.com/agiledragon/gomonkey/v2.(*Patches).ApplyCore(0x1400000c090, {0x100bc3c60?, 0x100be5b70?, 0x14000010480?}, {0x100bc3c60?, 0x100be5b78?, 0x100be68c8?})
/Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:213 +0x80
github.com/agiledragon/gomonkey/v2.(*Patches).ApplyFunc(0x14000098ef8?, {0x100bc3c60?, 0x100be5b70?}, {0x100bc3c60, 0x100be5b78})
/Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:83 +0x74
github.com/agiledragon/gomonkey/v2.ApplyFunc({0x100bc3c60, 0x100be5b70}, {0x100bc3c60, 0x100be5b78})
/Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:25 +0x44
command-line-arguments.TestName(0x0?)
/Users//Documents/tap4fun/c6/gs/tmp/main_test.go:20 +0x48
testing.tRunner(0x14000120340, 0x100be5b80)
/Users//.gvm/gos/go1.18.5/src/testing/testing.go:1439 +0x118
created by testing.(*T).Run
/Users//.gvm/gos/go1.18.5/src/testing/testing.go:1486 +0x2d8
FAIL command-line-arguments 0.085s
FAIL

The test code:

`
package main

import (
"testing"

"github.com/agiledragon/gomonkey/v2"
)

func TestName(t *testing.T) {
Print()
p := gomonkey.ApplyFunc(Print, func() {
t.Logf("b")
})
defer p.Reset()

Print()
}

func Print() {
}

`

![image](https://user-images.githubusercontent.com/93570733/194695827-26a3574b-2baa-4c6a-ba0c-a29901f5bc2f.png)

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。