Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to patch function while in init() #22

Open
Matt7983 opened this issue Jun 25, 2024 · 0 comments
Open

Unable to patch function while in init() #22

Matt7983 opened this issue Jun 25, 2024 · 0 comments

Comments

@Matt7983
Copy link

因為在init()階段加入了第三方套件的initialize
firestore.NewClient(context.Background(), projectID)
想要把這個function替換掉

monkey.Patch(firestore.NewClient, func(ctx context.Context, projectID string, opts ...option.ClientOption) (*firestore.Client, error) {
					 client := &firestore.Client{}
					 return client, nil
				 })

但發現在init()的階段會失敗
移動到測試function就可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant