khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame^] | 1 | // 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. |
| 7 | package pragma |
| 8 | |
| 9 | import "sync" |
| 10 | |
| 11 | // NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals. |
| 12 | type 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. |
| 19 | type DoNotImplement interface{ ProtoInternal(DoNotImplement) } |
| 20 | |
| 21 | // DoNotCompare can be embedded in a struct to prevent comparability. |
| 22 | type 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. |
| 29 | type DoNotCopy [0]sync.Mutex |