blob: 49dc4fcd98e6269afecc40d359d8fae0a9ba8aba [file] [log] [blame]
David K. Bainbridgee05cf0c2021-08-19 03:16:50 +00001// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package pragma provides types that can be embedded into a struct to
6// statically enforce or prevent certain language properties.
7package pragma
8
9import "sync"
10
11// NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals.
12type NoUnkeyedLiterals struct{}
13
14// DoNotImplement can be embedded in an interface to prevent trivial
15// implementations of the interface.
16//
17// This is useful to prevent unauthorized implementations of an interface
18// so that it can be extended in the future for any protobuf language changes.
19type DoNotImplement interface{ ProtoInternal(DoNotImplement) }
20
21// DoNotCompare can be embedded in a struct to prevent comparability.
22type DoNotCompare [0]func()
23
24// DoNotCopy can be embedded in a struct to help prevent shallow copies.
25// This does not rely on a Go language feature, but rather a special case
26// within the vet checker.
27//
28// See https://golang.org/issues/8005.
29type DoNotCopy [0]sync.Mutex