How to reuse test code in imported package? [duplicate]

风流意气都作罢 提交于 2019-12-01 06:07:40
Bestbug

If you use this function in *_test.go file throughout the project it's a good idea to move it to a utils package and import this package in your *_test.go. Moreover since this util package is used only for testing purposes I suggest to save the output of the internal function of pkg1 in a support file and load it when you call the support package's function which should use the private function of pkg1.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!