mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 13:43:47 +03:00
This commit is contained in:
parent
a4a64a6f6e
commit
f4840cfeb8
2 changed files with 5 additions and 5 deletions
|
@ -21,18 +21,18 @@ import (
|
||||||
type adjacency map[string][]string
|
type adjacency map[string][]string
|
||||||
|
|
||||||
type importGraph struct {
|
type importGraph struct {
|
||||||
nodes map[string]bool
|
nodes map[string]struct{}
|
||||||
edges adjacency
|
edges adjacency
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *importGraph) addNode(name string) {
|
func (i *importGraph) addNode(name string) {
|
||||||
if i.nodes == nil {
|
if i.nodes == nil {
|
||||||
i.nodes = make(map[string]bool)
|
i.nodes = make(map[string]struct{})
|
||||||
}
|
}
|
||||||
if _, exists := i.nodes[name]; exists {
|
if _, exists := i.nodes[name]; exists {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
i.nodes[name] = true
|
i.nodes[name] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *importGraph) addNodes(names []string) {
|
func (i *importGraph) addNodes(names []string) {
|
||||||
|
@ -66,7 +66,7 @@ func (i *importGraph) addEdge(from, to string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if i.nodes == nil {
|
if i.nodes == nil {
|
||||||
i.nodes = make(map[string]bool)
|
i.nodes = make(map[string]struct{})
|
||||||
}
|
}
|
||||||
if i.edges == nil {
|
if i.edges == nil {
|
||||||
i.edges = make(adjacency)
|
i.edges = make(adjacency)
|
||||||
|
|
|
@ -50,7 +50,7 @@ func Parse(filename string, input []byte) ([]ServerBlock, error) {
|
||||||
p := parser{
|
p := parser{
|
||||||
Dispenser: NewDispenser(tokens),
|
Dispenser: NewDispenser(tokens),
|
||||||
importGraph: importGraph{
|
importGraph: importGraph{
|
||||||
nodes: make(map[string]bool),
|
nodes: make(map[string]struct{}),
|
||||||
edges: make(adjacency),
|
edges: make(adjacency),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue