You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeLockable[Tany] struct {
Tmu sync.Mutex
}
// Get returns the value stored in a Lockable.func (l*Lockable[T]) Get() T {
l.mu.Lock()
deferl.mu.Unlock()
returnl.T
}
// Set sets the value in a Lockable.func (l*Lockable[T]) Set(vT) {
l.mu.Lock()
deferl.mu.Unlock()
l.T=v
}
What did you expect to see?
compile success
What did you see instead?
~/dev/go2playground ~/goroot/bin/go test
# go2playground [go2playground.test]
./main_test.go:50:2: embedded field type cannot be a (pointer to a) type parameter
gucio321, aikrops, rszyma, azuline, AmadeusK525 and 9 more