Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Glob ¶
type Glob struct {
RootDir *Dir
}
Example (ExcludeSome) ¶
glob, err := NewGlob([]string{ "!proto", "proto@A,B", "proto/good", "!proto/good@C", }) fmt.Println("Glob create error:", err) fmt.Println("Glob tree:") printDirs(glob.RootDir, " ")
Output: Glob create error: <nil> Glob tree: ExcludeInterfaces: false InterfacesExceptions: [] ExcludeSubdirs: false Subdirs: ├─Name: proto │ ExcludeInterfaces: true │ InterfacesExceptions: [A, B] │ ExcludeSubdirs: true │ Subdirs: │ ├─Name: good │ │ ExcludeInterfaces: false │ │ InterfacesExceptions: [C] │ │ ExcludeSubdirs: false │ │ Subdirs:
Example (IncludeSome) ¶
glob, err := NewGlob([]string{ "!.", "internal/service@A,B", "internal/server", "!internal/server@BadInterface", }) fmt.Println("Glob create error:", err) fmt.Println("Glob tree:") printDirs(glob.RootDir, " ")
Output: Glob create error: <nil> Glob tree: ExcludeInterfaces: true InterfacesExceptions: [] ExcludeSubdirs: true Subdirs: ├─Name: internal │ ExcludeInterfaces: true │ InterfacesExceptions: [] │ ExcludeSubdirs: true │ Subdirs: │ ├─Name: server │ │ ExcludeInterfaces: false │ │ InterfacesExceptions: [BadInterface] │ │ ExcludeSubdirs: false │ │ Subdirs: │ ├─Name: service │ │ ExcludeInterfaces: true │ │ InterfacesExceptions: [A, B] │ │ ExcludeSubdirs: true │ │ Subdirs:
Example (RevertingRule) ¶
glob, err := NewGlob([]string{ "!abc@A,B,C,D", "abc@C,B", }) fmt.Println("Glob create error:", err) fmt.Println("Glob tree:") printDirs(glob.RootDir, " ")
Output: Glob create error: <nil> Glob tree: ExcludeInterfaces: false InterfacesExceptions: [] ExcludeSubdirs: false Subdirs: ├─Name: abc │ ExcludeInterfaces: false │ InterfacesExceptions: [A, D] │ ExcludeSubdirs: false │ Subdirs:
Example (Root) ¶
_, err := NewGlob([]string{ "@A", }) fmt.Println("Glob create error:", err) _, err = NewGlob([]string{ "!", }) fmt.Println("Glob create error:", err) glob, err := NewGlob([]string{ "!.", ".@A,B", }) fmt.Println("Glob create error:", err) fmt.Println("Glob tree:") printDirs(glob.RootDir, " ")
Output: Glob create error: rule 1: use . for root dir Glob create error: rule 1: use . for root dir Glob create error: <nil> Glob tree: ExcludeInterfaces: true InterfacesExceptions: [A, B] ExcludeSubdirs: true Subdirs:
Example (Simple) ¶
glob, err := NewGlob([]string{}) fmt.Println("Glob create error:", err) fmt.Println("Glob tree:") printDirs(glob.RootDir, " ")
Output: Glob create error: <nil> Glob tree: ExcludeInterfaces: false InterfacesExceptions: [] ExcludeSubdirs: false Subdirs:
Example (TooManyAtSigns) ¶
_, err := NewGlob([]string{ "abc@kj@ie", }) fmt.Println("Glob create error:", err)
Output: Glob create error: rule 1: only one @ allowed
Click to show internal directories.
Click to hide internal directories.