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

cli.go里面cancel的作用 #10

Closed
andyblog opened this issue Jun 2, 2021 · 1 comment
Closed

cli.go里面cancel的作用 #10

andyblog opened this issue Jun 2, 2021 · 1 comment

Comments

@andyblog
Copy link

andyblog commented Jun 2, 2021

在项目 /cmd/cli/cli.go里面有cancel()方法,而且grpc.DialContext也继承了上面创建的上下文,如果提前执行cancel,那grpc的连接不是和上面那个上下文一样就会被cancel取消吗,不知道放在这里的作用是什么,是不是defer cancel()更好

@wwcd
Copy link
Owner

wwcd commented Jun 2, 2021

看一下DialContext的帮助,你就明白了。

@wwcd wwcd closed this as completed Jul 28, 2022
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

2 participants