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

fix: use a sync.Map to prevent "concurrent map read and map write" fa… #1923

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tinmrn
Copy link

@tinmrn tinmrn commented Nov 18, 2024

…tal error when using "output: prefixed"

fixes #1922

@@ -85,11 +86,11 @@ func (pw *prefixWriter) writeLine(line string) error {
line += "\n"
}

idx, ok := pw.prefixed.seen[pw.prefix]
idx, ok := pw.prefixed.seen.Load(pw.prefix)
Copy link

Choose a reason for hiding this comment

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

Perhaps LoadOrStore() is better than Load() and then Store()?

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.

fatal error: concurrent map read and map write - in internal/output.(*prefixWriter).writeLine
2 participants