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

lsp: Return copies of cache maps #760

Merged
merged 1 commit into from
May 28, 2024

Conversation

charlieegan3
Copy link
Member

Fixes: #750

@@ -84,7 +84,12 @@ func (c *Cache) GetAllFiles() map[string]string {
c.fileContentsMu.Lock()
defer c.fileContentsMu.Unlock()

return c.fileContents
cp := make(map[string]string, len(c.fileContents))
Copy link
Member

Choose a reason for hiding this comment

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

I believe we could use maps.Clone for this

Copy link
Member Author

@charlieegan3 charlieegan3 May 28, 2024

Choose a reason for hiding this comment

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

Ooh go is cool now.

Copy link
Member Author

@charlieegan3 charlieegan3 May 28, 2024

Choose a reason for hiding this comment

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

I have added this in 14290c4

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

LGTM, but @srenatus suggestion sounds good

Addressing: StyraInc#750

Signed-off-by: Charlie Egan <[email protected]>
@anderseknert anderseknert merged commit cf93614 into StyraInc:main May 28, 2024
3 checks passed
@charlieegan3 charlieegan3 deleted the return-map-copies branch May 28, 2024 12:49
srenatus pushed a commit to srenatus/regal that referenced this pull request Oct 1, 2024
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.

Completions: "fatal error: concurrent map iteration and map write" when trying completion
3 participants