Documentation
¶
Overview ¶
Package pragma provides types that can be embedded into a struct to statically enforce or prevent certain language properties. The key observation and some code (shr) is borrowed from https://github.com/protocolbuffers/protobuf-go/blob/v1.25.0/internal/pragma/pragma.go
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CopyChecker ¶ added in v0.0.96
type CopyChecker uintptr
CopyChecker holds back pointer to itself to detect object copying. Deprecated. use DoNotCopy instead, check by go vet. methods Copied or Check return not copied if none of methods Copied or Check have bee called before
func (*CopyChecker) Check ¶ added in v0.0.96
func (c *CopyChecker) Check()
Check panic is c is copied
func (*CopyChecker) Copied ¶ added in v0.0.96
func (c *CopyChecker) Copied() bool
Copied returns true if this object is copied
type DoNotCompare ¶
type DoNotCompare [0]func()
DoNotCompare can be embedded in a struct to prevent comparability.
type DoNotCopy ¶
DoNotCopy can be embedded in a struct to help prevent shallow copies. This does not rely on a Go language feature, but rather a special case within the vet checker.
See https://golang.org/issues/8005.
Example ¶
Output: Assignment copies lock value to '_': type 'DoNotCopy' contains 'sync.Mutex' which is 'sync.Locker'
type DoNotImplement ¶
type DoNotImplement interface{ ProtoInternal(doNotImplement) }
type NoUnkeyedLiterals ¶
type NoUnkeyedLiterals struct{}
NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals.