agiledragon / agiledragon/gomonkey

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

Open
#113 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
192
Avg merge
1d 6h
Merged PRs (30d)
1

Description

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)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.