From ae8186c7a4cfa89b3262a2cbe40825d0ebe3321a Mon Sep 17 00:00:00 2001 From: Erno Aapa Date: Thu, 8 Feb 2018 21:56:02 +0200 Subject: [PATCH] Formated files with --simplify flag --- .vscode/settings.json | 6 ++++++ cmd/eli/runCommand.go | 2 +- cmd/eli/upCommand.go | 2 +- pkg/api/server_test.go | 4 ++-- pkg/api/services/pods/v1/defaults_test.go | 6 +++--- pkg/model/pod_test.go | 8 ++++---- pkg/model/validation_test.go | 4 ++-- pkg/printers/interface_test.go | 12 ++++++------ 8 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..751720aa --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "go.formatTool": "gofmt", + "go.formatFlags": [ + "-s" + ] +} \ No newline at end of file diff --git a/cmd/eli/runCommand.go b/cmd/eli/runCommand.go index ff2ba9ac..23263d5d 100644 --- a/cmd/eli/runCommand.go +++ b/cmd/eli/runCommand.go @@ -125,7 +125,7 @@ var runCommand = cli.Command{ Spec: &pods.PodSpec{ HostNetwork: true, Containers: []*containers.Container{ - &containers.Container{ + { Name: name, Image: image, Tty: tty, diff --git a/cmd/eli/upCommand.go b/cmd/eli/upCommand.go index e7bcdb1e..7f357854 100644 --- a/cmd/eli/upCommand.go +++ b/cmd/eli/upCommand.go @@ -166,7 +166,7 @@ var upCommand = cli.Command{ Spec: &pods.PodSpec{ HostNetwork: true, Containers: []*containers.Container{ - &containers.Container{ + { Name: name, Image: image, Tty: tty, diff --git a/pkg/api/server_test.go b/pkg/api/server_test.go index 69204d1b..7147ed93 100644 --- a/pkg/api/server_test.go +++ b/pkg/api/server_test.go @@ -8,10 +8,10 @@ import ( func TestGetMetadataValue(t *testing.T) { md := map[string][]string{ - "foo": []string{ + "foo": { "bar", }, - "crazy": []string{ + "crazy": { "first", "second", }, diff --git a/pkg/api/services/pods/v1/defaults_test.go b/pkg/api/services/pods/v1/defaults_test.go index 1875673d..ec4e312f 100644 --- a/pkg/api/services/pods/v1/defaults_test.go +++ b/pkg/api/services/pods/v1/defaults_test.go @@ -10,7 +10,7 @@ import ( func TestDefaults(t *testing.T) { pods := []*Pod{ - &Pod{ + { Metadata: &core.ResourceMetadata{ Name: "foobar", }, @@ -18,14 +18,14 @@ func TestDefaults(t *testing.T) { Containers: []*containers.Container{}, }, }, - &Pod{ + { Metadata: &core.ResourceMetadata{ Name: "foobar", Namespace: "my-namespace", }, Spec: &PodSpec{ Containers: []*containers.Container{ - &containers.Container{ + { Name: "foo", Image: "docker.io/library/hello-world:latest", }, diff --git a/pkg/model/pod_test.go b/pkg/model/pod_test.go index d093a7d5..056883a2 100644 --- a/pkg/model/pod_test.go +++ b/pkg/model/pod_test.go @@ -48,7 +48,7 @@ func TestValidationRequiresMetadata(t *testing.T) { assert.Error(t, getValidator().Struct(Pod{ Spec: PodSpec{ Containers: []Container{ - Container{ + { Name: "foo", Image: "docker.io/eaapa/hello-world:latest", }, @@ -62,7 +62,7 @@ func TestValidationNameMetadata(t *testing.T) { Metadata: Metadata{}, Spec: PodSpec{ Containers: []Container{ - Container{ + { Name: "foo", Image: "docker.io/eaapa/hello-world:latest", }, @@ -76,7 +76,7 @@ func TestValidationNameMetadata(t *testing.T) { }, Spec: PodSpec{ Containers: []Container{ - Container{ + { Name: "foo", Image: "docker.io/eaapa/hello-world:latest", }, @@ -93,7 +93,7 @@ func TestValidationNamespaceMetadata(t *testing.T) { }, Spec: PodSpec{ Containers: []Container{ - Container{ + { Name: "foo", Image: "docker.io/eaapa/hello-world:latest", }, diff --git a/pkg/model/validation_test.go b/pkg/model/validation_test.go index bd60a66f..acba6ba6 100644 --- a/pkg/model/validation_test.go +++ b/pkg/model/validation_test.go @@ -8,13 +8,13 @@ import ( func TestValidationIsValid(t *testing.T) { err := Validate([]Pod{ - Pod{ + { Metadata: Metadata{ Name: "foo", }, Spec: PodSpec{ Containers: []Container{ - Container{ + { Name: "foo-1", Image: "docker.io/library/foobar", Args: []string{ diff --git a/pkg/printers/interface_test.go b/pkg/printers/interface_test.go index d151473f..c11ed8bb 100644 --- a/pkg/printers/interface_test.go +++ b/pkg/printers/interface_test.go @@ -20,8 +20,8 @@ var examplePod = &pods.Pod{ }, Spec: &pods.PodSpec{ Containers: []*containers.Container{ - &containers.Container{}, - &containers.Container{}, + {}, + {}, }, }, } @@ -78,7 +78,7 @@ func testPrintDevice(t *testing.T, printer ResourcePrinter) { var buffer bytes.Buffer data := &device.Info{ - Labels: []*device.Label{&device.Label{Key: "foo", Value: "bar"}}, + Labels: []*device.Label{{Key: "foo", Value: "bar"}}, Hostname: "foo-bar", Addresses: []string{"1.2.3.4"}, GrpcPort: 5000, @@ -118,8 +118,8 @@ func testPrintPod(t *testing.T, printer ResourcePrinter) { }, Spec: &pods.PodSpec{ Containers: []*containers.Container{ - &containers.Container{}, - &containers.Container{}, + {}, + {}, }, }, Status: &pods.PodStatus{ @@ -139,7 +139,7 @@ func testPrintConfig(t *testing.T, printer ResourcePrinter) { data := &config.Config{ Endpoints: []config.Endpoint{ - config.Endpoint{Name: "localhost", URL: "localhost:5000"}, + {Name: "localhost", URL: "localhost:5000"}, }, Namespace: "default", }