Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReportViolations ¶
func ReportViolations(pass *analysis.Pass, violations []PackageOnlyViolation)
ReportViolations reports packageonly violations using the new pretty formatter NOTE: violations should already be filtered by @ignore directives in CheckPackageOnly
Types ¶
type PackageOnlyViolation ¶
type PackageOnlyViolation struct {
Pos token.Pos
ItemName string // Name of the @packageonly object being used
ItemPkgPath string // Package path where the item is defined
CurrentPkgPath string // Current package path where the violation occurred
AllowedPackages []string // Allowed packages for this item
ReceiverType string // Receiver type for methods (empty for types/functions)
Code string // Error code for this violation
}
PackageOnlyViolation represents a violation of @packageonly usage @immutable implements reporting.Violation
func CheckPackageOnly ¶
func CheckPackageOnly( cfg *config.Config, pass *analysis.Pass, packageAnnotations *annotations.PackageAnnotations, ignoreSet *util.IgnoreSet, ) []PackageOnlyViolation
CheckPackageOnly checks that @packageonly annotated items are only used in allowed packages
func (PackageOnlyViolation) GetCode ¶
func (v PackageOnlyViolation) GetCode() string
GetCode returns the error code for this violation
func (PackageOnlyViolation) GetMessage ¶
func (v PackageOnlyViolation) GetMessage() string
GetMessage returns the main error message without formatting
func (PackageOnlyViolation) GetPos ¶
func (v PackageOnlyViolation) GetPos() token.Pos
GetPos returns the position of the violation
Click to show internal directories.
Click to hide internal directories.