Documentation ¶
Overview ¶
Package importvet implements import path linter.
Index ¶
Constants ¶
const ( ActionAllow = Action("allow") ActionDeny = Action("deny") )
Defined actions.
Variables ¶
var Analyzer = &analysis.Analyzer{ Name: "importvet", Doc: "checks that import paths conforman to restrictions", Run: run, FactTypes: []analysis.Fact{new(importFact)}, }
Analyzer ...
Functions ¶
func InitConfig ¶
InitConfig should be called to initialize configs for the import restrictions.
Types ¶
type Config ¶
Config is YAML representation of the config.
func LoadConfig ¶
LoadConfig loads import restrictions config from specified path.
type ConfigTree ¶
type ConfigTree struct {
// contains filtered or unexported fields
}
ConfigTree accumulates config files by looking recursively over the tree.
func NewConfigTree ¶
func NewConfigTree(rootPath string) (*ConfigTree, error)
NewConfigTree generates config tree by walking the source tree.
type Rule ¶
type Rule struct { // Regexp is regular expression against the import path. Regexp string `yaml:"regexp"` // Set is a way to refer to some set of packages (e.g. `std` packages). Set string `yaml:"set"` // Action is one of the "Allow", "Deny" Action Action `yaml:"action"` // Stop indicates whether rule processing should stop or continue. Stop bool `yaml:"stop"` // contains filtered or unexported fields }
Rule represents single import restriction rule.
type RuleSet ¶
type RuleSet struct {
Rules []Rule `yaml:"rules"`
}
RuleSet is an order set of Rules processed top-down.
Rules are processed firewall-style, top-down, only matching rules are applied. Action of the last matched rule (or rule with Stop enabled) is the action taken. Default action is 'allow'.