Skip to content

[bugfix] Fix for data race in PascalCase#942

Open
dragneelfps wants to merge 1 commit into
uber:masterfrom
dragneelfps:bugfix-data-race-casing
Open

[bugfix] Fix for data race in PascalCase#942
dragneelfps wants to merge 1 commit into
uber:masterfrom
dragneelfps:bugfix-data-race-casing

Conversation

@dragneelfps

Copy link
Copy Markdown

when using PascalCase in parallel constructs, the existing code can lead to data races.
Using once.Do will ensure the initialization happens only once.

@CLAassistant

CLAassistant commented Jun 26, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread codegen/casing.go

var pascalCaseMap *sync.Map
var (
pascalCaseMap *sync.Map

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use pascalCaseMap sync.Map, which will create a sync.Map and we don't need sync.Once and no need to check for nil.

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

Successfully merging this pull request may close these issues.

3 participants