diff options
author | danish-mehmood <[email protected]> | 2024-04-08 16:12:35 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-08 17:12:35 -0600 |
commit | f4840cfeb85ac33d29a1ab88d474750041a98733 (patch) | |
tree | d80ea3355f10349042360e5374b70ca3e0cbe21c | |
parent | a4a64a6f6ea054688f1492bacaa7d80a099f7e54 (diff) | |
download | caddy-f4840cfeb85ac33d29a1ab88d474750041a98733.tar.gz caddy-f4840cfeb85ac33d29a1ab88d474750041a98733.zip |
caddyconfig: Use empty struct instead of bool in map (close #6224) (#6227)
-rw-r--r-- | caddyconfig/caddyfile/importgraph.go | 8 | ||||
-rw-r--r-- | caddyconfig/caddyfile/parse.go | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/caddyconfig/caddyfile/importgraph.go b/caddyconfig/caddyfile/importgraph.go index d27f4710b..d5037fe62 100644 --- a/caddyconfig/caddyfile/importgraph.go +++ b/caddyconfig/caddyfile/importgraph.go @@ -21,18 +21,18 @@ import ( type adjacency map[string][]string type importGraph struct { - nodes map[string]bool + nodes map[string]struct{} edges adjacency } func (i *importGraph) addNode(name string) { if i.nodes == nil { - i.nodes = make(map[string]bool) + i.nodes = make(map[string]struct{}) } if _, exists := i.nodes[name]; exists { return } - i.nodes[name] = true + i.nodes[name] = struct{}{} } func (i *importGraph) addNodes(names []string) { @@ -66,7 +66,7 @@ func (i *importGraph) addEdge(from, to string) error { } if i.nodes == nil { - i.nodes = make(map[string]bool) + i.nodes = make(map[string]struct{}) } if i.edges == nil { i.edges = make(adjacency) diff --git a/caddyconfig/caddyfile/parse.go b/caddyconfig/caddyfile/parse.go index 9f79d913a..cdb9a7619 100644 --- a/caddyconfig/caddyfile/parse.go +++ b/caddyconfig/caddyfile/parse.go @@ -50,7 +50,7 @@ func Parse(filename string, input []byte) ([]ServerBlock, error) { p := parser{ Dispenser: NewDispenser(tokens), importGraph: importGraph{ - nodes: make(map[string]bool), + nodes: make(map[string]struct{}), edges: make(adjacency), }, } |