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

race condition when calling Theme.Tips concurrently #95

Open
unkmonster opened this issue Aug 21, 2024 · 0 comments
Open

race condition when calling Theme.Tips concurrently #95

unkmonster opened this issue Aug 21, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@unkmonster
Copy link

System (please complete the following information):

  • OS: window [e.g. linux, macOS]
  • GO Version: 1.13 [e.g. 1.13]
  • Pkg Version: 1.1.1 [e.g. 1.1.1]

ENV info on the terminal (by command env | grep -i TERM)

// paste env info.
Windows 11 Terminal

Describe the bug

Multiple goroutines calling Theme.Tips concurrently may cause mixed output

Since both t.Print and Printf perform I/O operations, concurrent writes to the output may lead to interleaved output.

To Reproduce

// go code
go func1() {
   color.Warn.Tips("some text 1")
}()

go func2() {
   color.Error.Tips("some text 2")
}()

Expected behavior

concurrent calls can output correctly

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

@inhere inhere added the bug Something isn't working label Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants