diff --git a/core/dnsserver/server.go b/core/dnsserver/server.go index c55f4db5f..fe509a21b 100644 --- a/core/dnsserver/server.go +++ b/core/dnsserver/server.go @@ -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. diff --git a/coremain/run.go b/coremain/run.go index 1c7e475ee..c792756ed 100644 --- a/coremain/run.go +++ b/coremain/run.go @@ -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 diff --git a/plugin/chaos/zowners.go b/plugin/chaos/zowners.go index c3668600e..272d98655 100644 --- a/plugin/chaos/zowners.go +++ b/plugin/chaos/zowners.go @@ -1,4 +1,4 @@ package chaos // Owners are all GitHub handlers of all maintainers. -var Owners = []string{"bradbeam", "chrisohaver", "dilyevsky", "ekleiner", "fastest963", "fturib", "greenpau", "grobie", "inigohu", "isolus", "johnbelamaric", "miekg", "nchrisdk", "nitisht", "pmoroney", "rajansandeep", "rdrozhdzh", "rtreffer", "stp-ip", "superq", "varyoo", "yongtang"} \ No newline at end of file +var Owners = []string{"bradbeam", "chrisohaver", "dilyevsky", "ekleiner", "fastest963", "fturib", "greenpau", "grobie", "inigohu", "isolus", "johnbelamaric", "miekg", "nchrisdk", "nitisht", "pmoroney", "rajansandeep", "rdrozhdzh", "rtreffer", "stp-ip", "superq", "varyoo", "yongtang"} diff --git a/plugin/kubernetes/controller.go b/plugin/kubernetes/controller.go index 233d6f548..6124a19cb 100644 --- a/plugin/kubernetes/controller.go +++ b/plugin/kubernetes/controller.go @@ -53,7 +53,7 @@ type dnsControl struct { client kubernetes.Interface - selector labels.Selector + selector labels.Selector namespaceSelector labels.Selector svcController cache.Controller @@ -84,10 +84,10 @@ type dnsControlOpts struct { ignoreEmptyService bool // Label handling. - labelSelector *meta.LabelSelector - selector labels.Selector + labelSelector *meta.LabelSelector + selector labels.Selector namespaceLabelSelector *meta.LabelSelector - namespaceSelector labels.Selector + namespaceSelector labels.Selector zones []string endpointNameMode bool @@ -96,12 +96,12 @@ type dnsControlOpts struct { // newDNSController creates a controller for CoreDNS. func newdnsController(kubeClient kubernetes.Interface, opts dnsControlOpts) *dnsControl { dns := dnsControl{ - client: kubeClient, - selector: opts.selector, + client: kubeClient, + selector: opts.selector, namespaceSelector: opts.namespaceSelector, - stopCh: make(chan struct{}), - zones: opts.zones, - endpointNameMode: opts.endpointNameMode, + stopCh: make(chan struct{}), + zones: opts.zones, + endpointNameMode: opts.endpointNameMode, } dns.svcLister, dns.svcController = object.NewIndexerInformer( diff --git a/plugin/kubernetes/namespace_test.go b/plugin/kubernetes/namespace_test.go index d7d2cbcce..c302b42ac 100644 --- a/plugin/kubernetes/namespace_test.go +++ b/plugin/kubernetes/namespace_test.go @@ -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{} diff --git a/plugin/log/setup_test.go b/plugin/log/setup_test.go index 678b6cf16..64f291445 100644 --- a/plugin/log/setup_test.go +++ b/plugin/log/setup_test.go @@ -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 diff --git a/plugin/metrics/vars/report.go b/plugin/metrics/vars/report.go index 343d98a22..77ed281f2 100644 --- a/plugin/metrics/vars/report.go +++ b/plugin/metrics/vars/report.go @@ -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" diff --git a/plugin/route53/route53_test.go b/plugin/route53/route53_test.go index 97a94df8e..5657e7c7a 100644 --- a/plugin/route53/route53_test.go +++ b/plugin/route53/route53_test.go @@ -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) }