Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶ added in v0.3.0
type Engine struct {
// contains filtered or unexported fields
}
Engine is the main ruleguard package API object.
First, load some ruleguard files with Load() to build a rule set. Then use Run() to execute the rules.
It's advised to have only 1 engine per application as it does a lot of caching. The Run() method is synchronized, so it can be used concurrently.
An Engine must be created with NewEngine() function.
func NewEngine ¶ added in v0.3.0
func NewEngine() *Engine
NewEngine creates an engine with empty rule set.
func (*Engine) Load ¶ added in v0.3.0
Load reads a ruleguard file from r and adds it to the engine rule set.
Load() is not thread-safe, especially if used concurrently with Run() method. It's advised to Load() all ruleguard files under a critical section (like sync.Once) and then use Run() to execute all of them.
type GoRuleInfo ¶ added in v0.1.4
type ParseContext ¶ added in v0.3.0
type ParseContext struct { DebugFilter string DebugImports bool DebugPrint func(string) // GroupFilter is called for every rule group being parsed. // If function returns false, that group will not be included // in the resulting rules set. // Nil filter accepts all rule groups. GroupFilter func(string) bool Fset *token.FileSet }
type RunContext ¶ added in v0.3.0
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package quasigo implements a Go subset compiler and interpreter.
|
Package quasigo implements a Go subset compiler and interpreter. |