Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Go
/
Go
A service struct contains a `sync.Mutex` that has already been used. Which change is safe?
from Go
intermediate
1 min
A service struct contains a `sync.Mutex` that has already been used. Which change is safe?
Keep the struct behind a pointer and use pointer receivers instead of copying it.
Pass the struct by value so each caller receives an independent lock.
Copy the mutex only while it happens to be unlocked.
Check
Ask AI about this kata
Report an error
previous kata
In `value, ok := <-ch`, which result becomes false after a closed channel has been draine…
Fill in
next kata
How does a `select` treat a send or receive case whose channel is nil?
Quiz
A new version is available
Reload