Avoid empty critical sections
This product is not supported for your selected
Datadog site. (
).
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください。
ID: go-best-practices/avoid-empty-critical-sections
Language: Go
Severity: Info
Category: Best Practices
Description
Empty critical sections are often a mistake. Instead of unlocking, developers often miss using defer
to defer
unlocking the mutex.
Non-Compliant Code Examples
func test() {
mutex.Lock()
mutex.Unlock()
}
Compliant Code Examples
func test() {
mutex.Lock()
doSomething()
mutex.Unlock()
}
シームレスな統合。 Datadog Code Security をお試しください