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
format.go nilToken not "thread" safe #533
Comments
Hi @TomerHeber! Thanks for reporting this. It seems like even if not running this codepath concurrently it's still incorrect for this to modify I believe the intent of a single shared Looking at the control flow here though, it seems like another plausible option would be to replace Based on that reasoning, the last change I described (replacing with If you'd be willing to write a PR for that, I'd be happy to review and merge it. Thanks! |
@apparentlymart I've created PR #534 |
Oh, whoops! I forgot to close this after I merged #534, but this is now fixed in the main branch in preparation for the next release. Thanks @TomerHeber! |
While running some tests I noticed the following issue in format.go
If
after
getsnilToken
it will be modified byafter.SpacesBefore = 0
orafter.SpacesBefore = 1
.When two or more goroutines run this will cause a race condition.
nilToken
should probably not be a global variable.Happy to fix it if that makes sense.
The text was updated successfully, but these errors were encountered: