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.
var EnableChaos = map[string]struct{}{
"chaos": struct{}{},
"forward": struct{}{},
"proxy": struct{}{},
"chaos": {},
"forward": {},
"proxy": {},
}
// 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.
var flagsBlacklist = map[string]struct{}{
"logtostderr": struct{}{},
"alsologtostderr": struct{}{},
"v": struct{}{},
"stderrthreshold": struct{}{},
"vmodule": struct{}{},
"log_backtrace_at": struct{}{},
"log_dir": struct{}{},
"logtostderr": {},
"alsologtostderr": {},
"v": {},
"stderrthreshold": {},
"vmodule": {},
"log_backtrace_at": {},
"log_dir": {},
}
var flagsToKeep []*flag.Flag

View file

@ -5,13 +5,13 @@ import (
)
func TestFilteredNamespaceExists(t *testing.T) {
tests := []struct{
tests := []struct {
expected bool
kubernetesNamespaces map[string]struct{}
testNamespace string
}{
{true, map[string]struct{}{}, "foobar" },
{false, map[string]struct{}{}, "nsnoexist" },
{true, map[string]struct{}{}, "foobar"},
{false, map[string]struct{}{}, "nsnoexist"},
}
k := Kubernetes{}
@ -26,15 +26,15 @@ func TestFilteredNamespaceExists(t *testing.T) {
}
func TestNamespaceExposed(t *testing.T) {
tests := []struct{
tests := []struct {
expected bool
kubernetesNamespaces map[string]struct{}
testNamespace string
}{
{true, map[string]struct{}{ "foobar": {} }, "foobar" },
{false, map[string]struct{}{ "foobar": {} }, "nsnoexist" },
{true, map[string]struct{}{}, "foobar" },
{true, map[string]struct{}{}, "nsnoexist" },
{true, map[string]struct{}{"foobar": {}}, "foobar"},
{false, map[string]struct{}{"foobar": {}}, "nsnoexist"},
{true, map[string]struct{}{}, "foobar"},
{true, map[string]struct{}{}, "nsnoexist"},
}
k := Kubernetes{}
@ -49,15 +49,15 @@ func TestNamespaceExposed(t *testing.T) {
}
func TestNamespaceValid(t *testing.T) {
tests := []struct{
tests := []struct {
expected bool
kubernetesNamespaces map[string]struct{}
testNamespace string
}{
{true, map[string]struct{}{ "foobar": {} }, "foobar" },
{false, map[string]struct{}{ "foobar": {} }, "nsnoexist" },
{true, map[string]struct{}{}, "foobar" },
{false, map[string]struct{}{}, "nsnoexist" },
{true, map[string]struct{}{"foobar": {}}, "foobar"},
{false, map[string]struct{}{"foobar": {}}, "nsnoexist"},
{true, map[string]struct{}{}, "foobar"},
{false, map[string]struct{}{}, "nsnoexist"},
}
k := Kubernetes{}

View file

@ -18,71 +18,71 @@ func TestLogParse(t *testing.T) {
{`log`, false, []Rule{{
NameScope: ".",
Format: DefaultLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org`, false, []Rule{{
NameScope: "example.org.",
Format: DefaultLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org. {common}`, false, []Rule{{
NameScope: "example.org.",
Format: CommonLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org {combined}`, false, []Rule{{
NameScope: "example.org.",
Format: CombinedLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org.
log example.net {combined}`, false, []Rule{{
NameScope: "example.org.",
Format: DefaultLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}, {
NameScope: "example.net.",
Format: CombinedLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org {host}
log example.org {when}`, false, []Rule{{
NameScope: "example.org.",
Format: "{host}",
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}, {
NameScope: "example.org.",
Format: "{when}",
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org example.net`, false, []Rule{{
NameScope: "example.org.",
Format: DefaultLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}, {
NameScope: "example.net.",
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{{
NameScope: "example.org.",
Format: "{host}",
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}, {
NameScope: "example.net.",
Format: "{host}",
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org example.net {when} {
class denial
}`, false, []Rule{{
NameScope: "example.org.",
Format: "{when}",
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
Class: map[response.Class]struct{}{response.Denial: {}},
}, {
NameScope: "example.net.",
Format: "{when}",
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
Class: map[response.Class]struct{}{response.Denial: {}},
}}},
{`log example.org {
@ -90,28 +90,28 @@ func TestLogParse(t *testing.T) {
}`, false, []Rule{{
NameScope: "example.org.",
Format: CommonLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
Class: map[response.Class]struct{}{response.All: {}},
}}},
{`log example.org {
class denial
}`, false, []Rule{{
NameScope: "example.org.",
Format: CommonLogFormat,
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
Class: map[response.Class]struct{}{response.Denial: {}},
}}},
{`log {
class denial
}`, false, []Rule{{
NameScope: ".",
Format: CommonLogFormat,
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
Class: map[response.Class]struct{}{response.Denial: {}},
}}},
{`log {
class denial error
}`, false, []Rule{{
NameScope: ".",
Format: CommonLogFormat,
Class: map[response.Class]struct{}{response.Denial: struct{}{}, response.Error: struct{}{}},
Class: map[response.Class]struct{}{response.Denial: {}, response.Error: {}},
}}},
{`log {
class denial
@ -119,7 +119,7 @@ func TestLogParse(t *testing.T) {
}`, false, []Rule{{
NameScope: ".",
Format: CommonLogFormat,
Class: map[response.Class]struct{}{response.Denial: struct{}{}, response.Error: struct{}{}},
Class: map[response.Class]struct{}{response.Denial: {}, response.Error: {}},
}}},
{`log {
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{}{
dns.TypeAAAA: struct{}{},
dns.TypeA: struct{}{},
dns.TypeCNAME: struct{}{},
dns.TypeDNSKEY: struct{}{},
dns.TypeDS: struct{}{},
dns.TypeMX: struct{}{},
dns.TypeNSEC3: struct{}{},
dns.TypeNSEC: struct{}{},
dns.TypeNS: struct{}{},
dns.TypePTR: struct{}{},
dns.TypeRRSIG: struct{}{},
dns.TypeSOA: struct{}{},
dns.TypeSRV: struct{}{},
dns.TypeTXT: struct{}{},
dns.TypeAAAA: {},
dns.TypeA: {},
dns.TypeCNAME: {},
dns.TypeDNSKEY: {},
dns.TypeDS: {},
dns.TypeMX: {},
dns.TypeNSEC3: {},
dns.TypeNSEC: {},
dns.TypeNS: {},
dns.TypePTR: {},
dns.TypeRRSIG: {},
dns.TypeSOA: {},
dns.TypeSRV: {},
dns.TypeTXT: {},
// Meta Qtypes
dns.TypeIXFR: struct{}{},
dns.TypeAXFR: struct{}{},
dns.TypeANY: struct{}{},
dns.TypeIXFR: {},
dns.TypeAXFR: {},
dns.TypeANY: {},
}
const other = "other"

View file

@ -79,7 +79,7 @@ func (fakeRoute53) ListResourceRecordSetsPagesWithContext(_ aws.Context, in *rou
func TestRoute53(t *testing.T) {
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 {
t.Fatalf("Failed to create Route53: %v", err)
}
@ -87,7 +87,7 @@ func TestRoute53(t *testing.T) {
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 {
t.Fatalf("Failed to create Route53: %v", err)
}