-
=== RUN TestName1
--- FAIL: TestName1 (0.00s)
panic: permission denied [recovered]
panic: permission denied
goroutine 83 [running]:
testing.tRunner.func1.2({0x100ff16a0, 0x1018edb88})
/usr…
-
https://xargin.com/patching-private-function-in-go/
-
I try to run tests on armbian, running on a RK3566 soc. Only the private method tests fail.
Go version: 1.21.6
-
```go
import (
"reflect"
"testing"
"github.com/agiledragon/gomonkey"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
)
func TestSeq_GIN(t *testing.T) {
ctrl := gomock.New…
-
在做单元测试的情况下, 会有一种需求是, 确定调用了某个函数,或者某个接口, 其它的mock框架基本都提供这种能力, gomonkey也可以, 但是需要一个一个的模拟, 有没有可能通过1.18的泛型, 写一个类似这样的Func结构
type Func[T any] struct {
callCount int
}
然后有这样的方法 MockFunc[T any](ps *Pa…
-
Go Version: go version go1.18.2 darwin/amd64
MacOS version: macOS Monterey, version 12.3.1, Intel
gomockey version: v2.9.0
Sample code
```
package go_play
import (
"fmt"
"github.com/agi…
-
环境
1. macOS Sonoma
2. AMD64
3. go 1.20.7
问题
之前都是正常使用,通过 cgo 引入 sqlite 依赖后,运行出现 permission denied 的问题。引入 cgo 的模块,跟 monkey patch 的模块没有任何关联。只是发现引入 cgo 后,monkey patch 的函数地址变得很大,40 多亿的一个整数,没有引入 cgo …
-
Behaviors:
1. Only one test case can run normally every time.
2. Multiple test cases lead to different random results.
### file1: http_request.go
```
package test
import (
"fmt"
"io"
"…
-
Hello Bitko,
it is return this error:
`refresh token must be passed in or set as part of setAccessToken`
But in your code is supposed to check if access token is expired and in that case gene…
-
https://github.com/huaweicloud/huaweicloud-sdk-go-obs/blob/782df337584adbb102afe9dd5e3eeaf6950e269e/obs/client.go#L102
对外接口里有内部数据类型参数(不止这一个接口),不知道这样设计的目的是什么,开发者绝对用不上,还导致自动化测试时无法mock
请使用gomonkey尝试m…