Skip to content

Commit

Permalink
atomic.TypedValue should noCopy
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Oct 26, 2023
1 parent 8898c13 commit 83a5dfb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions atomic/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func DefaultValue[T any]() T {

type TypedValue[T any] struct {
value atomic.Value
_ noCopy
}

func (t *TypedValue[T]) Load() T {
Expand Down Expand Up @@ -55,3 +56,9 @@ func NewTypedValue[T any](t T) (v TypedValue[T]) {
v.Store(t)
return
}

type noCopy struct{}

// Lock is a no-op used by -copylocks checker from `go vet`.
func (*noCopy) Lock() {}
func (*noCopy) Unlock() {}

0 comments on commit 83a5dfb

Please sign in to comment.