Closed
Description
Seeing these errors from gopls in the workspace diagnostics list for these files.
The first error is real.
The second error is not real and should not be reported.
(The expression there is a type, not a value, so errors about copying values are confusing and wrong. Also the expected type at that point in the literal is a *T not a T, so once the first error is corrected, there will be no lock copy. Just as there is no error that T is not a *T, there should be no error that T holds a lock.)
/Users/rsc/src/rsc.io/tmp/goplsbug/x.go:8.31,8.32: T (type) is not an expression
/Users/rsc/src/rsc.io/tmp/goplsbug/x.go:8.31,8.32: literal copies lock value from T: rsc.io/tmp/goplsbug.T contains sync.Mutex
% cat go.mod
module rsc.io/tmp/goplsbug
% cat x.go
package main
import "sync"
type T struct{ mu sync.Mutex }
type T1 struct{ t *T }
func NewT1() *T1 { return &T1{T} }
%