sync.Mutex
or sync.RWMutex
methods exposed GO-W4013Exposing sync.Mutex
or sync.RWMutex
allows the caller to Lock
or Unlock
the underlying mutex, potentially leading to a deadlock.
package main
import (
"sync"
)
type Foo struct {
sync.Mutex
A int
}
package main
import (
"sync"
)
type Foo struct {
A int
lock sync.Mutex
}