Run gofmt -w -s on codebase (#2773)

This formats and simplifies all code by running gofmt -w -s on all Go
files.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2019-04-08 11:13:46 +01:00 committed by GitHub
parent e3f9a80b1d
commit 58c703f5ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 71 additions and 71 deletions

View file

@ -346,9 +346,9 @@ type Key struct{}
// EnableChaos is a map with plugin names for which we should open CH class queries as we block these by default. // EnableChaos is a map with plugin names for which we should open CH class queries as we block these by default.
var EnableChaos = map[string]struct{}{ var EnableChaos = map[string]struct{}{
"chaos": struct{}{}, "chaos": {},
"forward": struct{}{}, "forward": {},
"proxy": struct{}{}, "proxy": {},
} }
// Quiet mode will not show any informative output on initialization. // Quiet mode will not show any informative output on initialization.

View file

@ -255,13 +255,13 @@ var (
// flagsBlacklist removes flags with these names from our flagset. // flagsBlacklist removes flags with these names from our flagset.
var flagsBlacklist = map[string]struct{}{ var flagsBlacklist = map[string]struct{}{
"logtostderr": struct{}{}, "logtostderr": {},
"alsologtostderr": struct{}{}, "alsologtostderr": {},
"v": struct{}{}, "v": {},
"stderrthreshold": struct{}{}, "stderrthreshold": {},
"vmodule": struct{}{}, "vmodule": {},
"log_backtrace_at": struct{}{}, "log_backtrace_at": {},
"log_dir": struct{}{}, "log_dir": {},
} }
var flagsToKeep []*flag.Flag var flagsToKeep []*flag.Flag

View file

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

View file

@ -40,24 +40,24 @@ func Report(server string, req request.Request, zone, rcode string, size int, st
} }
var monitorType = map[uint16]struct{}{ var monitorType = map[uint16]struct{}{
dns.TypeAAAA: struct{}{}, dns.TypeAAAA: {},
dns.TypeA: struct{}{}, dns.TypeA: {},
dns.TypeCNAME: struct{}{}, dns.TypeCNAME: {},
dns.TypeDNSKEY: struct{}{}, dns.TypeDNSKEY: {},
dns.TypeDS: struct{}{}, dns.TypeDS: {},
dns.TypeMX: struct{}{}, dns.TypeMX: {},
dns.TypeNSEC3: struct{}{}, dns.TypeNSEC3: {},
dns.TypeNSEC: struct{}{}, dns.TypeNSEC: {},
dns.TypeNS: struct{}{}, dns.TypeNS: {},
dns.TypePTR: struct{}{}, dns.TypePTR: {},
dns.TypeRRSIG: struct{}{}, dns.TypeRRSIG: {},
dns.TypeSOA: struct{}{}, dns.TypeSOA: {},
dns.TypeSRV: struct{}{}, dns.TypeSRV: {},
dns.TypeTXT: struct{}{}, dns.TypeTXT: {},
// Meta Qtypes // Meta Qtypes
dns.TypeIXFR: struct{}{}, dns.TypeIXFR: {},
dns.TypeAXFR: struct{}{}, dns.TypeAXFR: {},
dns.TypeANY: struct{}{}, dns.TypeANY: {},
} }
const other = "other" const other = "other"

View file

@ -79,7 +79,7 @@ func (fakeRoute53) ListResourceRecordSetsPagesWithContext(_ aws.Context, in *rou
func TestRoute53(t *testing.T) { func TestRoute53(t *testing.T) {
ctx := context.Background() ctx := context.Background()
r, err := New(ctx, fakeRoute53{}, map[string][]string{"bad.": []string{"0987654321"}}, &upstream.Upstream{}) r, err := New(ctx, fakeRoute53{}, map[string][]string{"bad.": {"0987654321"}}, &upstream.Upstream{})
if err != nil { if err != nil {
t.Fatalf("Failed to create Route53: %v", err) t.Fatalf("Failed to create Route53: %v", err)
} }
@ -87,7 +87,7 @@ func TestRoute53(t *testing.T) {
t.Fatalf("Expected errors for zone bad.") t.Fatalf("Expected errors for zone bad.")
} }
r, err = New(ctx, fakeRoute53{}, map[string][]string{"org.": []string{"1357986420", "1234567890"}, "gov.": []string{"Z098765432", "1234567890"}}, &upstream.Upstream{}) r, err = New(ctx, fakeRoute53{}, map[string][]string{"org.": {"1357986420", "1234567890"}, "gov.": {"Z098765432", "1234567890"}}, &upstream.Upstream{})
if err != nil { if err != nil {
t.Fatalf("Failed to create Route53: %v", err) t.Fatalf("Failed to create Route53: %v", err)
} }