Skip to content

Commit 6284cf5

Browse files
jsorefthaJeztah
authored andcommitted
gofmt: 5 files
gofmt from go1.8.3 hg locate '*.go' |xargs ~/go/bin/gofmt -s -w Signed-off-by: Josh Soref <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 8bc6812 commit 6284cf5

File tree

5 files changed

+91
-91
lines changed

5 files changed

+91
-91
lines changed

api/types/filters/parse_test.go

+40-40
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ func TestFromParam(t *testing.T) {
9090
`{"key": "value"}`,
9191
}
9292
valid := map[*Args][]string{
93-
&Args{fields: map[string]map[string]bool{"key": {"value": true}}}: {
93+
{fields: map[string]map[string]bool{"key": {"value": true}}}: {
9494
`{"key": ["value"]}`,
9595
`{"key": {"value": true}}`,
9696
},
97-
&Args{fields: map[string]map[string]bool{"key": {"value1": true, "value2": true}}}: {
97+
{fields: map[string]map[string]bool{"key": {"value1": true, "value2": true}}}: {
9898
`{"key": ["value1", "value2"]}`,
9999
`{"key": {"value1": true, "value2": true}}`,
100100
},
101-
&Args{fields: map[string]map[string]bool{"key1": {"value1": true}, "key2": {"value2": true}}}: {
101+
{fields: map[string]map[string]bool{"key1": {"value1": true}, "key2": {"value2": true}}}: {
102102
`{"key1": ["value1"], "key2": ["value2"]}`,
103103
`{"key1": {"value1": true}, "key2": {"value2": true}}`,
104104
},
@@ -172,14 +172,14 @@ func TestArgsMatchKVList(t *testing.T) {
172172
}
173173

174174
matches := map[*Args]string{
175-
&Args{}: "field",
176-
&Args{map[string]map[string]bool{
177-
"created": map[string]bool{"today": true},
178-
"labels": map[string]bool{"key1": true}},
175+
{}: "field",
176+
{map[string]map[string]bool{
177+
"created": {"today": true},
178+
"labels": {"key1": true}},
179179
}: "labels",
180-
&Args{map[string]map[string]bool{
181-
"created": map[string]bool{"today": true},
182-
"labels": map[string]bool{"key1=value1": true}},
180+
{map[string]map[string]bool{
181+
"created": {"today": true},
182+
"labels": {"key1=value1": true}},
183183
}: "labels",
184184
}
185185

@@ -190,16 +190,16 @@ func TestArgsMatchKVList(t *testing.T) {
190190
}
191191

192192
differs := map[*Args]string{
193-
&Args{map[string]map[string]bool{
194-
"created": map[string]bool{"today": true}},
193+
{map[string]map[string]bool{
194+
"created": {"today": true}},
195195
}: "created",
196-
&Args{map[string]map[string]bool{
197-
"created": map[string]bool{"today": true},
198-
"labels": map[string]bool{"key4": true}},
196+
{map[string]map[string]bool{
197+
"created": {"today": true},
198+
"labels": {"key4": true}},
199199
}: "labels",
200-
&Args{map[string]map[string]bool{
201-
"created": map[string]bool{"today": true},
202-
"labels": map[string]bool{"key1=value3": true}},
200+
{map[string]map[string]bool{
201+
"created": {"today": true},
202+
"labels": {"key1=value3": true}},
203203
}: "labels",
204204
}
205205

@@ -214,21 +214,21 @@ func TestArgsMatch(t *testing.T) {
214214
source := "today"
215215

216216
matches := map[*Args]string{
217-
&Args{}: "field",
218-
&Args{map[string]map[string]bool{
219-
"created": map[string]bool{"today": true}},
217+
{}: "field",
218+
{map[string]map[string]bool{
219+
"created": {"today": true}},
220220
}: "today",
221-
&Args{map[string]map[string]bool{
222-
"created": map[string]bool{"to*": true}},
221+
{map[string]map[string]bool{
222+
"created": {"to*": true}},
223223
}: "created",
224-
&Args{map[string]map[string]bool{
225-
"created": map[string]bool{"to(.*)": true}},
224+
{map[string]map[string]bool{
225+
"created": {"to(.*)": true}},
226226
}: "created",
227-
&Args{map[string]map[string]bool{
228-
"created": map[string]bool{"tod": true}},
227+
{map[string]map[string]bool{
228+
"created": {"tod": true}},
229229
}: "created",
230-
&Args{map[string]map[string]bool{
231-
"created": map[string]bool{"anyting": true, "to*": true}},
230+
{map[string]map[string]bool{
231+
"created": {"anyting": true, "to*": true}},
232232
}: "created",
233233
}
234234

@@ -239,21 +239,21 @@ func TestArgsMatch(t *testing.T) {
239239
}
240240

241241
differs := map[*Args]string{
242-
&Args{map[string]map[string]bool{
243-
"created": map[string]bool{"tomorrow": true}},
242+
{map[string]map[string]bool{
243+
"created": {"tomorrow": true}},
244244
}: "created",
245-
&Args{map[string]map[string]bool{
246-
"created": map[string]bool{"to(day": true}},
245+
{map[string]map[string]bool{
246+
"created": {"to(day": true}},
247247
}: "created",
248-
&Args{map[string]map[string]bool{
249-
"created": map[string]bool{"tom(.*)": true}},
248+
{map[string]map[string]bool{
249+
"created": {"tom(.*)": true}},
250250
}: "created",
251-
&Args{map[string]map[string]bool{
252-
"created": map[string]bool{"tom": true}},
251+
{map[string]map[string]bool{
252+
"created": {"tom": true}},
253253
}: "created",
254-
&Args{map[string]map[string]bool{
255-
"created": map[string]bool{"today1": true},
256-
"labels": map[string]bool{"today": true}},
254+
{map[string]map[string]bool{
255+
"created": {"today1": true},
256+
"labels": {"today": true}},
257257
}: "created",
258258
}
259259

image/cache/compare_test.go

+23-23
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func TestCompare(t *testing.T) {
4646

4747
sameConfigs := map[*container.Config]*container.Config{
4848
// Empty config
49-
&container.Config{}: {},
49+
{}: {},
5050
// Does not compare hostname, domainname & image
51-
&container.Config{
51+
{
5252
Hostname: "host1",
5353
Domainname: "domain1",
5454
Image: "image1",
@@ -60,23 +60,23 @@ func TestCompare(t *testing.T) {
6060
User: "user",
6161
},
6262
// only OpenStdin
63-
&container.Config{OpenStdin: false}: {OpenStdin: false},
63+
{OpenStdin: false}: {OpenStdin: false},
6464
// only env
65-
&container.Config{Env: envs1}: {Env: envs1},
65+
{Env: envs1}: {Env: envs1},
6666
// only cmd
67-
&container.Config{Cmd: cmd1}: {Cmd: cmd1},
67+
{Cmd: cmd1}: {Cmd: cmd1},
6868
// only labels
69-
&container.Config{Labels: labels1}: {Labels: labels1},
69+
{Labels: labels1}: {Labels: labels1},
7070
// only exposedPorts
71-
&container.Config{ExposedPorts: ports1}: {ExposedPorts: ports1},
71+
{ExposedPorts: ports1}: {ExposedPorts: ports1},
7272
// only entrypoints
73-
&container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint1},
73+
{Entrypoint: entrypoint1}: {Entrypoint: entrypoint1},
7474
// only volumes
75-
&container.Config{Volumes: volumes1}: {Volumes: volumes1},
75+
{Volumes: volumes1}: {Volumes: volumes1},
7676
}
7777
differentConfigs := map[*container.Config]*container.Config{
7878
nil: nil,
79-
&container.Config{
79+
{
8080
Hostname: "host1",
8181
Domainname: "domain1",
8282
Image: "image1",
@@ -88,30 +88,30 @@ func TestCompare(t *testing.T) {
8888
User: "user2",
8989
},
9090
// only OpenStdin
91-
&container.Config{OpenStdin: false}: {OpenStdin: true},
92-
&container.Config{OpenStdin: true}: {OpenStdin: false},
91+
{OpenStdin: false}: {OpenStdin: true},
92+
{OpenStdin: true}: {OpenStdin: false},
9393
// only env
94-
&container.Config{Env: envs1}: {Env: envs2},
94+
{Env: envs1}: {Env: envs2},
9595
// only cmd
96-
&container.Config{Cmd: cmd1}: {Cmd: cmd2},
96+
{Cmd: cmd1}: {Cmd: cmd2},
9797
// not the same number of parts
98-
&container.Config{Cmd: cmd1}: {Cmd: cmd3},
98+
{Cmd: cmd1}: {Cmd: cmd3},
9999
// only labels
100-
&container.Config{Labels: labels1}: {Labels: labels2},
100+
{Labels: labels1}: {Labels: labels2},
101101
// not the same number of labels
102-
&container.Config{Labels: labels1}: {Labels: labels3},
102+
{Labels: labels1}: {Labels: labels3},
103103
// only exposedPorts
104-
&container.Config{ExposedPorts: ports1}: {ExposedPorts: ports2},
104+
{ExposedPorts: ports1}: {ExposedPorts: ports2},
105105
// not the same number of ports
106-
&container.Config{ExposedPorts: ports1}: {ExposedPorts: ports3},
106+
{ExposedPorts: ports1}: {ExposedPorts: ports3},
107107
// only entrypoints
108-
&container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint2},
108+
{Entrypoint: entrypoint1}: {Entrypoint: entrypoint2},
109109
// not the same number of parts
110-
&container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint3},
110+
{Entrypoint: entrypoint1}: {Entrypoint: entrypoint3},
111111
// only volumes
112-
&container.Config{Volumes: volumes1}: {Volumes: volumes2},
112+
{Volumes: volumes1}: {Volumes: volumes2},
113113
// not the same number of labels
114-
&container.Config{Volumes: volumes1}: {Volumes: volumes3},
114+
{Volumes: volumes1}: {Volumes: volumes3},
115115
}
116116
for config1, config2 := range sameConfigs {
117117
if !compare(config1, config2) {

pkg/jsonlog/jsonlog_marshalling_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import (
77

88
func TestJSONLogMarshalJSON(t *testing.T) {
99
logs := map[*JSONLog]string{
10-
&JSONLog{Log: `"A log line with \\"`}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":\".{20,}\"}$`,
11-
&JSONLog{Log: "A log line"}: `^{\"log\":\"A log line\",\"time\":\".{20,}\"}$`,
12-
&JSONLog{Log: "A log line with \r"}: `^{\"log\":\"A log line with \\r\",\"time\":\".{20,}\"}$`,
13-
&JSONLog{Log: "A log line with & < >"}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":\".{20,}\"}$`,
14-
&JSONLog{Log: "A log line with utf8 : 🚀 ψ ω β"}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":\".{20,}\"}$`,
15-
&JSONLog{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":\".{20,}\"}$`,
16-
&JSONLog{}: `^{\"time\":\".{20,}\"}$`,
10+
{Log: `"A log line with \\"`}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":\".{20,}\"}$`,
11+
{Log: "A log line"}: `^{\"log\":\"A log line\",\"time\":\".{20,}\"}$`,
12+
{Log: "A log line with \r"}: `^{\"log\":\"A log line with \\r\",\"time\":\".{20,}\"}$`,
13+
{Log: "A log line with & < >"}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":\".{20,}\"}$`,
14+
{Log: "A log line with utf8 : 🚀 ψ ω β"}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":\".{20,}\"}$`,
15+
{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":\".{20,}\"}$`,
16+
{}: `^{\"time\":\".{20,}\"}$`,
1717
// These ones are a little weird
18-
&JSONLog{Log: "\u2028 \u2029"}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":\".{20,}\"}$`,
19-
&JSONLog{Log: string([]byte{0xaF})}: `^{\"log\":\"\\ufffd\",\"time\":\".{20,}\"}$`,
20-
&JSONLog{Log: string([]byte{0x7F})}: `^{\"log\":\"\x7f\",\"time\":\".{20,}\"}$`,
18+
{Log: "\u2028 \u2029"}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":\".{20,}\"}$`,
19+
{Log: string([]byte{0xaF})}: `^{\"log\":\"\\ufffd\",\"time\":\".{20,}\"}$`,
20+
{Log: string([]byte{0x7F})}: `^{\"log\":\"\x7f\",\"time\":\".{20,}\"}$`,
2121
}
2222
for jsonLog, expression := range logs {
2323
data, err := jsonLog.MarshalJSON()

pkg/jsonlog/jsonlogbytes_test.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ import (
88

99
func TestJSONLogsMarshalJSONBuf(t *testing.T) {
1010
logs := map[*JSONLogs]string{
11-
&JSONLogs{Log: []byte(`"A log line with \\"`)}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":}$`,
12-
&JSONLogs{Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"time\":}$`,
13-
&JSONLogs{Log: []byte("A log line with \r")}: `^{\"log\":\"A log line with \\r\",\"time\":}$`,
14-
&JSONLogs{Log: []byte("A log line with & < >")}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":}$`,
15-
&JSONLogs{Log: []byte("A log line with utf8 : 🚀 ψ ω β")}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":}$`,
16-
&JSONLogs{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":}$`,
17-
&JSONLogs{Stream: "stdout", Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"stream\":\"stdout\",\"time\":}$`,
18-
&JSONLogs{Created: "time"}: `^{\"time\":time}$`,
19-
&JSONLogs{}: `^{\"time\":}$`,
11+
{Log: []byte(`"A log line with \\"`)}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":}$`,
12+
{Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"time\":}$`,
13+
{Log: []byte("A log line with \r")}: `^{\"log\":\"A log line with \\r\",\"time\":}$`,
14+
{Log: []byte("A log line with & < >")}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":}$`,
15+
{Log: []byte("A log line with utf8 : 🚀 ψ ω β")}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":}$`,
16+
{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":}$`,
17+
{Stream: "stdout", Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"stream\":\"stdout\",\"time\":}$`,
18+
{Created: "time"}: `^{\"time\":time}$`,
19+
{}: `^{\"time\":}$`,
2020
// These ones are a little weird
21-
&JSONLogs{Log: []byte("\u2028 \u2029")}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":}$`,
22-
&JSONLogs{Log: []byte{0xaF}}: `^{\"log\":\"\\ufffd\",\"time\":}$`,
23-
&JSONLogs{Log: []byte{0x7F}}: `^{\"log\":\"\x7f\",\"time\":}$`,
21+
{Log: []byte("\u2028 \u2029")}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":}$`,
22+
{Log: []byte{0xaF}}: `^{\"log\":\"\\ufffd\",\"time\":}$`,
23+
{Log: []byte{0x7F}}: `^{\"log\":\"\x7f\",\"time\":}$`,
2424
// with raw attributes
25-
&JSONLogs{Log: []byte("A log line"), RawAttrs: []byte(`{"hello":"world","value":1234}`)}: `^{\"log\":\"A log line\",\"attrs\":{\"hello\":\"world\",\"value\":1234},\"time\":}$`,
25+
{Log: []byte("A log line"), RawAttrs: []byte(`{"hello":"world","value":1234}`)}: `^{\"log\":\"A log line\",\"attrs\":{\"hello\":\"world\",\"value\":1234},\"time\":}$`,
2626
}
2727
for jsonLog, expression := range logs {
2828
var buf bytes.Buffer

runconfig/hostconfig_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ func TestPidModeTest(t *testing.T) {
167167
func TestRestartPolicy(t *testing.T) {
168168
restartPolicies := map[container.RestartPolicy][]bool{
169169
// none, always, failure
170-
container.RestartPolicy{}: {true, false, false},
171-
container.RestartPolicy{Name: "something", MaximumRetryCount: 0}: {false, false, false},
172-
container.RestartPolicy{Name: "no", MaximumRetryCount: 0}: {true, false, false},
173-
container.RestartPolicy{Name: "always", MaximumRetryCount: 0}: {false, true, false},
174-
container.RestartPolicy{Name: "on-failure", MaximumRetryCount: 0}: {false, false, true},
170+
{}: {true, false, false},
171+
{Name: "something", MaximumRetryCount: 0}: {false, false, false},
172+
{Name: "no", MaximumRetryCount: 0}: {true, false, false},
173+
{Name: "always", MaximumRetryCount: 0}: {false, true, false},
174+
{Name: "on-failure", MaximumRetryCount: 0}: {false, false, true},
175175
}
176176
for restartPolicy, state := range restartPolicies {
177177
if restartPolicy.IsNone() != state[0] {

0 commit comments

Comments
 (0)