package mock import ( kptservicemock "kpt-tmr-group/module/backend/mock" "kpt-tmr-group/pkg/di" "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, )