aboutsummaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'util.go')
-rw-r--r--util.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/util.go b/util.go
index d6f1985..daf2817 100644
--- a/util.go
+++ b/util.go
@@ -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() {}