-
想做个能记录mockFn被调用多少次以及每次调用入参的工具函数,源码如下:
``` go
type Recorder struct {
history [][]reflect.Value
m *gomonkey.Patches
}
func (r *Recorder) Times() int {
return len(r.history)
}
func …
-
1. [goconvey](https://github.com/smartystreets/goconvey)
2. [testify](https://github.com/stretchr/testify)
reference:
[vs](https://knapsackpro.com/testing_frameworks/difference_between/goconvey/v…
-
- platform: mac intel
- go verison: go1.16.5 darwin/amd64
- gomonkey version: v2.3.0
- problem: go test apply_private_method_test.go failed
- successed code:
```
package unit
import (
"…
-
比如如下方法
```
package student
var Student = student{}
type student struct {}
func (s student) GetName() {
return "zhangsan"
}
```
-
https://draveness.me/golang-101
-
OS manages memory in units of pages. Code segment not writable, so we should call `syscall.Mprotect` method in golang.
Blog [Monkey Patching in Go](https://bou.ke/blog/monkey-patching-in-go/) tell…
-
Please add v2.2.0 to version list
It's very great to hear arm is supported in v2.2.0, however, when try to use v2.2.0, I meet error
```go get: github.com/agiledragon/gomonkey@v2.2.0: invalid versio…
-
```go
func MyFun() int {
return 1
}
func TestMock(t *testing.T) {
Convey("mock", t, func() {
p := gomonkey.ApplyFunc(MyFun, func() int { return 11 })
i := MyFun()
So(i, ShouldEqual, …
-
我写了一个小 demo 模拟这个问题
首先目录结构如下图
![image](https://user-images.githubusercontent.com/31313340/112832786-65295a80-90c8-11eb-8a69-769a1f152a6c.png)
**persion.go 代码如下**
```go
package model
import (…
-
When I execute `go get github.com/agiledragon/gomonkey`, I got following error:
`go get github.com/agiledragon/gomonkey: no matching versions for query "upgrade"`
Supported Platform:
- MAC O…