gofmt from go1.8.3
hg locate '*.go' |xargs ~/go/bin/gofmt -s -w
Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
... | ... |
@@ -90,15 +90,15 @@ func TestFromParam(t *testing.T) { |
90 | 90 |
`{"key": "value"}`, |
91 | 91 |
} |
92 | 92 |
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}}}: { |
|
94 | 94 |
`{"key": ["value"]}`, |
95 | 95 |
`{"key": {"value": true}}`, |
96 | 96 |
}, |
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}}}: { |
|
98 | 98 |
`{"key": ["value1", "value2"]}`, |
99 | 99 |
`{"key": {"value1": true, "value2": true}}`, |
100 | 100 |
}, |
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}}}: { |
|
102 | 102 |
`{"key1": ["value1"], "key2": ["value2"]}`, |
103 | 103 |
`{"key1": {"value1": true}, "key2": {"value2": true}}`, |
104 | 104 |
}, |
... | ... |
@@ -172,14 +172,14 @@ func TestArgsMatchKVList(t *testing.T) { |
172 | 172 |
} |
173 | 173 |
|
174 | 174 |
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}}, |
|
179 | 179 |
}: "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}}, |
|
183 | 183 |
}: "labels", |
184 | 184 |
} |
185 | 185 |
|
... | ... |
@@ -190,16 +190,16 @@ func TestArgsMatchKVList(t *testing.T) { |
190 | 190 |
} |
191 | 191 |
|
192 | 192 |
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}}, |
|
195 | 195 |
}: "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}}, |
|
199 | 199 |
}: "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}}, |
|
203 | 203 |
}: "labels", |
204 | 204 |
} |
205 | 205 |
|
... | ... |
@@ -214,21 +214,21 @@ func TestArgsMatch(t *testing.T) { |
214 | 214 |
source := "today" |
215 | 215 |
|
216 | 216 |
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}}, |
|
220 | 220 |
}: "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}}, |
|
223 | 223 |
}: "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}}, |
|
226 | 226 |
}: "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}}, |
|
229 | 229 |
}: "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}}, |
|
232 | 232 |
}: "created", |
233 | 233 |
} |
234 | 234 |
|
... | ... |
@@ -239,21 +239,21 @@ func TestArgsMatch(t *testing.T) { |
239 | 239 |
} |
240 | 240 |
|
241 | 241 |
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}}, |
|
244 | 244 |
}: "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}}, |
|
247 | 247 |
}: "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}}, |
|
250 | 250 |
}: "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}}, |
|
253 | 253 |
}: "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}}, |
|
257 | 257 |
}: "created", |
258 | 258 |
} |
259 | 259 |
|
... | ... |
@@ -46,9 +46,9 @@ func TestCompare(t *testing.T) { |
46 | 46 |
|
47 | 47 |
sameConfigs := map[*container.Config]*container.Config{ |
48 | 48 |
// Empty config |
49 |
- &container.Config{}: {}, |
|
49 |
+ {}: {}, |
|
50 | 50 |
// Does not compare hostname, domainname & image |
51 |
- &container.Config{ |
|
51 |
+ { |
|
52 | 52 |
Hostname: "host1", |
53 | 53 |
Domainname: "domain1", |
54 | 54 |
Image: "image1", |
... | ... |
@@ -60,23 +60,23 @@ func TestCompare(t *testing.T) { |
60 | 60 |
User: "user", |
61 | 61 |
}, |
62 | 62 |
// only OpenStdin |
63 |
- &container.Config{OpenStdin: false}: {OpenStdin: false}, |
|
63 |
+ {OpenStdin: false}: {OpenStdin: false}, |
|
64 | 64 |
// only env |
65 |
- &container.Config{Env: envs1}: {Env: envs1}, |
|
65 |
+ {Env: envs1}: {Env: envs1}, |
|
66 | 66 |
// only cmd |
67 |
- &container.Config{Cmd: cmd1}: {Cmd: cmd1}, |
|
67 |
+ {Cmd: cmd1}: {Cmd: cmd1}, |
|
68 | 68 |
// only labels |
69 |
- &container.Config{Labels: labels1}: {Labels: labels1}, |
|
69 |
+ {Labels: labels1}: {Labels: labels1}, |
|
70 | 70 |
// only exposedPorts |
71 |
- &container.Config{ExposedPorts: ports1}: {ExposedPorts: ports1}, |
|
71 |
+ {ExposedPorts: ports1}: {ExposedPorts: ports1}, |
|
72 | 72 |
// only entrypoints |
73 |
- &container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint1}, |
|
73 |
+ {Entrypoint: entrypoint1}: {Entrypoint: entrypoint1}, |
|
74 | 74 |
// only volumes |
75 |
- &container.Config{Volumes: volumes1}: {Volumes: volumes1}, |
|
75 |
+ {Volumes: volumes1}: {Volumes: volumes1}, |
|
76 | 76 |
} |
77 | 77 |
differentConfigs := map[*container.Config]*container.Config{ |
78 | 78 |
nil: nil, |
79 |
- &container.Config{ |
|
79 |
+ { |
|
80 | 80 |
Hostname: "host1", |
81 | 81 |
Domainname: "domain1", |
82 | 82 |
Image: "image1", |
... | ... |
@@ -88,30 +88,30 @@ func TestCompare(t *testing.T) { |
88 | 88 |
User: "user2", |
89 | 89 |
}, |
90 | 90 |
// 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}, |
|
93 | 93 |
// only env |
94 |
- &container.Config{Env: envs1}: {Env: envs2}, |
|
94 |
+ {Env: envs1}: {Env: envs2}, |
|
95 | 95 |
// only cmd |
96 |
- &container.Config{Cmd: cmd1}: {Cmd: cmd2}, |
|
96 |
+ {Cmd: cmd1}: {Cmd: cmd2}, |
|
97 | 97 |
// not the same number of parts |
98 |
- &container.Config{Cmd: cmd1}: {Cmd: cmd3}, |
|
98 |
+ {Cmd: cmd1}: {Cmd: cmd3}, |
|
99 | 99 |
// only labels |
100 |
- &container.Config{Labels: labels1}: {Labels: labels2}, |
|
100 |
+ {Labels: labels1}: {Labels: labels2}, |
|
101 | 101 |
// not the same number of labels |
102 |
- &container.Config{Labels: labels1}: {Labels: labels3}, |
|
102 |
+ {Labels: labels1}: {Labels: labels3}, |
|
103 | 103 |
// only exposedPorts |
104 |
- &container.Config{ExposedPorts: ports1}: {ExposedPorts: ports2}, |
|
104 |
+ {ExposedPorts: ports1}: {ExposedPorts: ports2}, |
|
105 | 105 |
// not the same number of ports |
106 |
- &container.Config{ExposedPorts: ports1}: {ExposedPorts: ports3}, |
|
106 |
+ {ExposedPorts: ports1}: {ExposedPorts: ports3}, |
|
107 | 107 |
// only entrypoints |
108 |
- &container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint2}, |
|
108 |
+ {Entrypoint: entrypoint1}: {Entrypoint: entrypoint2}, |
|
109 | 109 |
// not the same number of parts |
110 |
- &container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint3}, |
|
110 |
+ {Entrypoint: entrypoint1}: {Entrypoint: entrypoint3}, |
|
111 | 111 |
// only volumes |
112 |
- &container.Config{Volumes: volumes1}: {Volumes: volumes2}, |
|
112 |
+ {Volumes: volumes1}: {Volumes: volumes2}, |
|
113 | 113 |
// not the same number of labels |
114 |
- &container.Config{Volumes: volumes1}: {Volumes: volumes3}, |
|
114 |
+ {Volumes: volumes1}: {Volumes: volumes3}, |
|
115 | 115 |
} |
116 | 116 |
for config1, config2 := range sameConfigs { |
117 | 117 |
if !compare(config1, config2) { |
... | ... |
@@ -7,17 +7,17 @@ import ( |
7 | 7 |
|
8 | 8 |
func TestJSONLogMarshalJSON(t *testing.T) { |
9 | 9 |
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,}\"}$`, |
|
17 | 17 |
// 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,}\"}$`, |
|
21 | 21 |
} |
22 | 22 |
for jsonLog, expression := range logs { |
23 | 23 |
data, err := jsonLog.MarshalJSON() |
... | ... |
@@ -8,21 +8,21 @@ import ( |
8 | 8 |
|
9 | 9 |
func TestJSONLogsMarshalJSONBuf(t *testing.T) { |
10 | 10 |
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\":}$`, |
|
20 | 20 |
// 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\":}$`, |
|
24 | 24 |
// 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\":}$`, |
|
26 | 26 |
} |
27 | 27 |
for jsonLog, expression := range logs { |
28 | 28 |
var buf bytes.Buffer |
... | ... |
@@ -167,11 +167,11 @@ func TestPidModeTest(t *testing.T) { |
167 | 167 |
func TestRestartPolicy(t *testing.T) { |
168 | 168 |
restartPolicies := map[container.RestartPolicy][]bool{ |
169 | 169 |
// 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}, |
|
175 | 175 |
} |
176 | 176 |
for restartPolicy, state := range restartPolicies { |
177 | 177 |
if restartPolicy.IsNone() != state[0] { |