map bool -> map struct{} (#2386)

This clear out the remaining map[x]bool usage and moves the bool to an
empty struct.

Two note worthy other changes:

* EnableChaos in the server is now also exported to make it show up in
  the documentation.
* The auto plugin is left as is, because there the boolean is
  explicitaly set to false to signal 'to-be-deleted' and the key is left
  as-is.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2018-12-10 10:17:15 +00:00
committed by Yong Tang
parent c788649a00
commit 9abbf4a4a0
9 changed files with 64 additions and 63 deletions

View File

@@ -18,42 +18,42 @@ func TestLogParse(t *testing.T) {
{`log`, false, []Rule{{
NameScope: ".",
Format: DefaultLogFormat,
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org`, false, []Rule{{
NameScope: "example.org.",
Format: DefaultLogFormat,
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org. {common}`, false, []Rule{{
NameScope: "example.org.",
Format: CommonLogFormat,
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org {combined}`, false, []Rule{{
NameScope: "example.org.",
Format: CombinedLogFormat,
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org.
log example.net {combined}`, false, []Rule{{
NameScope: "example.org.",
Format: DefaultLogFormat,
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}, {
NameScope: "example.net.",
Format: CombinedLogFormat,
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org {host}
log example.org {when}`, false, []Rule{{
NameScope: "example.org.",
Format: "{host}",
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}, {
NameScope: "example.org.",
Format: "{when}",
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org {
@@ -61,28 +61,28 @@ func TestLogParse(t *testing.T) {
}`, false, []Rule{{
NameScope: "example.org.",
Format: CommonLogFormat,
Class: map[response.Class]bool{response.All: true},
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org {
class denial
}`, false, []Rule{{
NameScope: "example.org.",
Format: CommonLogFormat,
Class: map[response.Class]bool{response.Denial: true},
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
}}},
{`log {
class denial
}`, false, []Rule{{
NameScope: ".",
Format: CommonLogFormat,
Class: map[response.Class]bool{response.Denial: true},
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
}}},
{`log {
class denial error
}`, false, []Rule{{
NameScope: ".",
Format: CommonLogFormat,
Class: map[response.Class]bool{response.Denial: true, response.Error: true},
Class: map[response.Class]struct{}{response.Denial: struct{}{}, response.Error: struct{}{}},
}}},
{`log {
class denial
@@ -90,7 +90,7 @@ func TestLogParse(t *testing.T) {
}`, false, []Rule{{
NameScope: ".",
Format: CommonLogFormat,
Class: map[response.Class]bool{response.Denial: true, response.Error: true},
Class: map[response.Class]struct{}{response.Denial: struct{}{}, response.Error: struct{}{}},
}}},
{`log {
class abracadabra