diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-12-03 11:53:48 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-12-03 11:53:48 +0000 |
| commit | 5b88af5109405a51b0c6f8237016707604109ca7 (patch) | |
| tree | 7a3f5a6086228ea69e88b17ab4c8955e5f11d5ef | |
| parent | 66757999fb5aa554d1277a21ba59a5f2e6ca0271 (diff) | |
Add NoCopy to flag types as not to be copied
See https://github.com/golang/go/issues/8005#issuecomment-190753527 for
more details.
| -rw-r--r-- | net.go | 2 | ||||
| -rw-r--r-- | util.go | 11 |
2 files changed, 13 insertions, 0 deletions
@@ -32,6 +32,8 @@ type PipeListener struct { closed int32 conns chan net.Conn done chan struct{} + + _ NoCopy } var _ net.Listener = &PipeListener{} @@ -10,3 +10,14 @@ func Must[T any](val T, err error) T { } return val } + +// NoCopy flags a type that embeds it as not to be copied. Go does not +// prevent values from being copied, but ‘go vet’ will pick it up and +// signal it, which can then be caught by many CI/CD pipelines. +// +// See https://github.com/golang/go/issues/8005#issuecomment-190753527 +// for more details. +type NoCopy struct{} + +func (*NoCopy) Lock() {} +func (*NoCopy) Unlock() {} |
