-
Notifications
You must be signed in to change notification settings - Fork 595
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
hclwrite: fix data race in formatSpaces() #511
Conversation
Hi @ryancragun! Thanks for tracking these down. For I feel less sure about the |
@apparentlymart I believe you're right on point. While I was moving |
Hi @ryancragun, I don't think it makes a huge amount of difference in practice, so I think what you did here is fine too... I was just focused on trying to understand what the data races were here so I could think about the consequences of these changes. 😀 Thanks for checking! |
I also checked on that failing Windows test and it seems like for some reason the Go toolchain thinks it needs to compile some C code in order to build HCL now. I don't see anything in your changeset here that introduces any new dependencies that might require CGo, so I guess probably what's happening is that the Go toolchain needs to rebuild everything in order to get race-detector-enabled versions of the standard library packages. If that is the reason then I think that should be fine, but I guess it means we'll need to make Since I believe we're intending to move away from CircleCI to GitHub Actions in the not-too-distant future anyway, perhaps a reasonable compromise for now would be to enable the race detector only for the linux tests for now, and then once we're on GitHub Actions we can use a more exhaustive build matrix and rely on the fact that the GitHub Actions images ship with a more reasonable set of base packages for software testing. |
I have precisely this PR's worth of experience using circleci, so that was my best guess at how to achieve only running the race detector on linux. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have very sophisticated knowledge of CircleCI myself (and I'm intentionally not learning more because we're going to move away from it before too long anyway!), but what you did here seems reasonable to me, especially with the expectation that this won't be in use very long before it gets replaced, and so it working is the most important thing.
9f8475a
to
f2d61a6
Compare
@apparentlymart small PSA that I dropped the circleci changes and rebased this. |
* Fix data race in `formatSpaces()` by inlining shared state. * Run tests with the race detector enabled. Signed-off-by: Ryan Cragun <me@ryan.ec>
f2d61a6
to
a26ee4f
Compare
Thanks for this! |
This fixes a data race in
formatSpaces()
by inlining shared state into the caller.Before
My apologies for the messy diff, my editor runs
gofumpt
andyamllint
so that's where the noise is coming from. If it's a problem let me know and I'll update it.Signed-off-by: Ryan Cragun me@ryan.ec