Closed kiyonlin closed 3 years ago
it seems the package name generated by test is not main, for example, on my machine:
if you want to patch a function, you need to provide its full package path(and a go.mod project will be some github.com/path/to/your/project/pkg.yourprivatefunction), I'll fix the doc as soon as possible
in Chinese
似乎 Go 的 test 生成的包名不是 main,而是我上面图前面那一串,是下划线 + 目录 + 函数名。
如果是在 go.mod 环境下的话,应该就是全路径,比如 github.com/cch123/elasticsql.Convert,这样的。
patch 的时候得写全路径,我是觉得 go.mod 或者有 GOPATH 的环境下问题不大?
我看看是不是能想办法对这种 test 环境做个特殊定制
Thanks for the quick response! I'll try the full package name.
@kiyonlin , I've done more tests on this, maybe it's hard to setup on linux. The default test binary generated by Go on linux does not have a symbol table, to make it work , I have to execute go test -c -o xxx.test && ./xxx.test
Alright, this is also an approach. I'm appreciate it very much.
Hey thanks for the awesome package!
I met some problems when using supermonkey in test.
And I run the test like
Did I miss something?