Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
Allow, Disallowed Location
}
Filter represents a location filter
func AllowedIn ¶
AllowedIn creates a location filter, where the given location must fully match all locations given.
For example:
f := In(File, InitFunction, Variable) f.Allowed(Variable) == false f.Allowed(File & Variable & InitFunction & Function) == true
func (Filter) Allowed ¶
Allowed returns true if this location allowed by this filter. See both AllowedIn and ButNotIn for examples
type Filters ¶
type Filters []Filter
Filters represents a list of location filters
func (Filters) Allowed ¶
Allowed returns true if _any_ of the filters allow the location, regardless if others do not
func (Filters) Describe ¶
Describe retuns an english description of where `what` can be `pastTenseVerb`
For example:
Filter{In(Function), In(InitFunction), In(Variable).NotIn(Function)}.Describe("foo", "called")
will return:
foo can be only be called in a function, an init function or a package level variable declaration
type Location ¶
type Location int
Location represents a bitwise flag of locations
const ( File Location = 1 << iota // Inside a file, outside a function body InitFunction // Inside an init function declaration Function // Inside any function declaration (including the init function) Variable // Inside a variable )
This list is ordered from most outer possible location, to most inner location
Click to show internal directories.
Click to hide internal directories.