package mock import ( "gitee.com/xuyiping_admin/pkg/di" kptservicemock "kpt-tmr-group/module/backend/mock" "github.com/golang/mock/gomock" ) func GetMock(ctrl *gomock.Controller, f interface{}) { container, err := di.New(di.Provide(func() *gomock.Controller { return ctrl }), deps) if err != nil { panic(err) } if err = container.Invoke(f); err != nil { panic(err) } } var deps = di.Provide( kptservicemock.NewMockKptService, )