1 2 3 4 5 6 7 8 9 10 11
package copylock import "sync" func BadFunc() { var x *sync.Mutex p := x var y sync.Mutex p = &y *p = *x // ERROR "assignment copies lock value to \*p: sync.Mutex" }