gomonkey is a library to make monkey patching in unit tests easy
gomonkey is a library to make monkey patching in unit tests easy, and the core idea of monkey patching comes from Bouke, you can read this blogpost for an explanation on how it works.
-gcflags=-l
(below go1.10) or -gcflags=all=-l
(go1.10 and above).ARCH
OS
$ go get github.com/agiledragon/[email protected]
$ go get github.com/agiledragon/gomonkey/[email protected]
$ cd test
$ go test -gcflags=all=-l
Please refer to the test cases as idioms, very complete and detailed.