pragma.go 1.1 KB

1234567891011121314151617181920212223242526272829
  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.md file.
  4. // Package pragma provides types that can be embedded into a struct to
  5. // statically enforce or prevent certain language properties.
  6. package pragma
  7. import "sync"
  8. // NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals.
  9. type NoUnkeyedLiterals struct{}
  10. // DoNotImplement can be embedded in an interface to prevent trivial
  11. // implementations of the interface.
  12. //
  13. // This is useful to prevent unauthorized implementations of an interface
  14. // so that it can be extended in the future for any protobuf language changes.
  15. type DoNotImplement interface{ ProtoInternal(DoNotImplement) }
  16. // DoNotCompare can be embedded in a struct to prevent comparability.
  17. type DoNotCompare [0]func()
  18. // DoNotCopy can be embedded in a struct to help prevent shallow copies.
  19. // This does not rely on a Go language feature, but rather a special case
  20. // within the vet checker.
  21. //
  22. // See https://golang.org/issues/8005.
  23. type DoNotCopy [0]sync.Mutex