# I want to mock this function
func testCheckPluginFile(fName string){
plugin, _ := plugin.Open(path.Join("/I/expect/folder/","/plugin-lib-test/"+fName))
plugin.Lookup("symbol")
}
# So I put this func like this
func testCheckPluginFile(fName string,pluginOpen func (path string) (*plugin.Plugin, error)){
plugin, _ := pluginOpen(path.Join("/I/expect/folder/","/plugin-lib-test/"+fName))
plugin.Lookup("symbol")
}
但我不能这样做,因为plugin.Plugin.lookup
你有另一种方法来解决它吗?