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

@ -1,4 +1,4 @@
package chaos package chaos
// Owners are all GitHub handlers of all maintainers. // 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"} 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"}

View file

@ -53,7 +53,7 @@ type dnsControl struct {
client kubernetes.Interface client kubernetes.Interface
selector labels.Selector selector labels.Selector
namespaceSelector labels.Selector namespaceSelector labels.Selector
svcController cache.Controller svcController cache.Controller
@ -84,10 +84,10 @@ type dnsControlOpts struct {
ignoreEmptyService bool ignoreEmptyService bool
// Label handling. // Label handling.
labelSelector *meta.LabelSelector labelSelector *meta.LabelSelector
selector labels.Selector selector labels.Selector
namespaceLabelSelector *meta.LabelSelector namespaceLabelSelector *meta.LabelSelector
namespaceSelector labels.Selector namespaceSelector labels.Selector
zones []string zones []string
endpointNameMode bool endpointNameMode bool
@ -96,12 +96,12 @@ type dnsControlOpts struct {
// newDNSController creates a controller for CoreDNS. // newDNSController creates a controller for CoreDNS.
func newdnsController(kubeClient kubernetes.Interface, opts dnsControlOpts) *dnsControl { func newdnsController(kubeClient kubernetes.Interface, opts dnsControlOpts) *dnsControl {
dns := dnsControl{ dns := dnsControl{
client: kubeClient, client: kubeClient,
selector: opts.selector, selector: opts.selector,
namespaceSelector: opts.namespaceSelector, namespaceSelector: opts.namespaceSelector,
stopCh: make(chan struct{}), stopCh: make(chan struct{}),
zones: opts.zones, zones: opts.zones,
endpointNameMode: opts.endpointNameMode, endpointNameMode: opts.endpointNameMode,
} }
dns.svcLister, dns.svcController = object.NewIndexerInformer( dns.svcLister, dns.svcController = object.NewIndexerInformer(

View file

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

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)
} }