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
proposal: sync: sync.Once.Do return done #53485
Comments
just curious (and for clarification): since |
Duplicate of #41690 |
@seankhliao that's not the same issue. |
False duplicate. |
it's just a slightly different api |
Issue #41690 is adding a new method. This is for adding a new return value for an existing method. I have read the reason why that issues was closed and it doesn't apply. In this case running the function and getting the return value are the same action. Please read @robpike's comment again. |
I agree that this is slightly different, but we still aren't going to do it. The Go 1 compatibility guarantee does not permit us to add a result type to the |
Issue
It would be useful to know whether a function protected by sync.Once has been run or not.
Example:
Proposal
The above code relies on making new variable and setting it in the closure. It could be more cleanly expressed if
sync.Once.Do
returntrue
orfalse
depending on whether the function has run.The text was updated successfully, but these errors were encountered: