gofmt: 5 files

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>
This commit is contained in:
Josh Soref 2017-05-26 06:25:58 +00:00 committed by Sebastiaan van Stijn
parent 8bc681262f
commit 6284cf5e9a
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
5 changed files with 91 additions and 91 deletions

View file

@ -90,15 +90,15 @@ func TestFromParam(t *testing.T) {
`{"key": "value"}`,
}
valid := map[*Args][]string{
&Args{fields: map[string]map[string]bool{"key": {"value": true}}}: {
{fields: map[string]map[string]bool{"key": {"value": true}}}: {
`{"key": ["value"]}`,
`{"key": {"value": true}}`,
},
&Args{fields: map[string]map[string]bool{"key": {"value1": true, "value2": true}}}: {
{fields: map[string]map[string]bool{"key": {"value1": true, "value2": true}}}: {
`{"key": ["value1", "value2"]}`,
`{"key": {"value1": true, "value2": true}}`,
},
&Args{fields: map[string]map[string]bool{"key1": {"value1": true}, "key2": {"value2": true}}}: {
{fields: map[string]map[string]bool{"key1": {"value1": true}, "key2": {"value2": true}}}: {
`{"key1": ["value1"], "key2": ["value2"]}`,
`{"key1": {"value1": true}, "key2": {"value2": true}}`,
},
@ -172,14 +172,14 @@ func TestArgsMatchKVList(t *testing.T) {
}
matches := map[*Args]string{
&Args{}: "field",
&Args{map[string]map[string]bool{
"created": map[string]bool{"today": true},
"labels": map[string]bool{"key1": true}},
{}: "field",
{map[string]map[string]bool{
"created": {"today": true},
"labels": {"key1": true}},
}: "labels",
&Args{map[string]map[string]bool{
"created": map[string]bool{"today": true},
"labels": map[string]bool{"key1=value1": true}},
{map[string]map[string]bool{
"created": {"today": true},
"labels": {"key1=value1": true}},
}: "labels",
}
@ -190,16 +190,16 @@ func TestArgsMatchKVList(t *testing.T) {
}
differs := map[*Args]string{
&Args{map[string]map[string]bool{
"created": map[string]bool{"today": true}},
{map[string]map[string]bool{
"created": {"today": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"today": true},
"labels": map[string]bool{"key4": true}},
{map[string]map[string]bool{
"created": {"today": true},
"labels": {"key4": true}},
}: "labels",
&Args{map[string]map[string]bool{
"created": map[string]bool{"today": true},
"labels": map[string]bool{"key1=value3": true}},
{map[string]map[string]bool{
"created": {"today": true},
"labels": {"key1=value3": true}},
}: "labels",
}
@ -214,21 +214,21 @@ func TestArgsMatch(t *testing.T) {
source := "today"
matches := map[*Args]string{
&Args{}: "field",
&Args{map[string]map[string]bool{
"created": map[string]bool{"today": true}},
{}: "field",
{map[string]map[string]bool{
"created": {"today": true}},
}: "today",
&Args{map[string]map[string]bool{
"created": map[string]bool{"to*": true}},
{map[string]map[string]bool{
"created": {"to*": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"to(.*)": true}},
{map[string]map[string]bool{
"created": {"to(.*)": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"tod": true}},
{map[string]map[string]bool{
"created": {"tod": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"anyting": true, "to*": true}},
{map[string]map[string]bool{
"created": {"anyting": true, "to*": true}},
}: "created",
}
@ -239,21 +239,21 @@ func TestArgsMatch(t *testing.T) {
}
differs := map[*Args]string{
&Args{map[string]map[string]bool{
"created": map[string]bool{"tomorrow": true}},
{map[string]map[string]bool{
"created": {"tomorrow": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"to(day": true}},
{map[string]map[string]bool{
"created": {"to(day": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"tom(.*)": true}},
{map[string]map[string]bool{
"created": {"tom(.*)": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"tom": true}},
{map[string]map[string]bool{
"created": {"tom": true}},
}: "created",
&Args{map[string]map[string]bool{
"created": map[string]bool{"today1": true},
"labels": map[string]bool{"today": true}},
{map[string]map[string]bool{
"created": {"today1": true},
"labels": {"today": true}},
}: "created",
}

View file

@ -46,9 +46,9 @@ func TestCompare(t *testing.T) {
sameConfigs := map[*container.Config]*container.Config{
// Empty config
&container.Config{}: {},
{}: {},
// Does not compare hostname, domainname & image
&container.Config{
{
Hostname: "host1",
Domainname: "domain1",
Image: "image1",
@ -60,23 +60,23 @@ func TestCompare(t *testing.T) {
User: "user",
},
// only OpenStdin
&container.Config{OpenStdin: false}: {OpenStdin: false},
{OpenStdin: false}: {OpenStdin: false},
// only env
&container.Config{Env: envs1}: {Env: envs1},
{Env: envs1}: {Env: envs1},
// only cmd
&container.Config{Cmd: cmd1}: {Cmd: cmd1},
{Cmd: cmd1}: {Cmd: cmd1},
// only labels
&container.Config{Labels: labels1}: {Labels: labels1},
{Labels: labels1}: {Labels: labels1},
// only exposedPorts
&container.Config{ExposedPorts: ports1}: {ExposedPorts: ports1},
{ExposedPorts: ports1}: {ExposedPorts: ports1},
// only entrypoints
&container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint1},
{Entrypoint: entrypoint1}: {Entrypoint: entrypoint1},
// only volumes
&container.Config{Volumes: volumes1}: {Volumes: volumes1},
{Volumes: volumes1}: {Volumes: volumes1},
}
differentConfigs := map[*container.Config]*container.Config{
nil: nil,
&container.Config{
{
Hostname: "host1",
Domainname: "domain1",
Image: "image1",
@ -88,30 +88,30 @@ func TestCompare(t *testing.T) {
User: "user2",
},
// only OpenStdin
&container.Config{OpenStdin: false}: {OpenStdin: true},
&container.Config{OpenStdin: true}: {OpenStdin: false},
{OpenStdin: false}: {OpenStdin: true},
{OpenStdin: true}: {OpenStdin: false},
// only env
&container.Config{Env: envs1}: {Env: envs2},
{Env: envs1}: {Env: envs2},
// only cmd
&container.Config{Cmd: cmd1}: {Cmd: cmd2},
{Cmd: cmd1}: {Cmd: cmd2},
// not the same number of parts
&container.Config{Cmd: cmd1}: {Cmd: cmd3},
{Cmd: cmd1}: {Cmd: cmd3},
// only labels
&container.Config{Labels: labels1}: {Labels: labels2},
{Labels: labels1}: {Labels: labels2},
// not the same number of labels
&container.Config{Labels: labels1}: {Labels: labels3},
{Labels: labels1}: {Labels: labels3},
// only exposedPorts
&container.Config{ExposedPorts: ports1}: {ExposedPorts: ports2},
{ExposedPorts: ports1}: {ExposedPorts: ports2},
// not the same number of ports
&container.Config{ExposedPorts: ports1}: {ExposedPorts: ports3},
{ExposedPorts: ports1}: {ExposedPorts: ports3},
// only entrypoints
&container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint2},
{Entrypoint: entrypoint1}: {Entrypoint: entrypoint2},
// not the same number of parts
&container.Config{Entrypoint: entrypoint1}: {Entrypoint: entrypoint3},
{Entrypoint: entrypoint1}: {Entrypoint: entrypoint3},
// only volumes
&container.Config{Volumes: volumes1}: {Volumes: volumes2},
{Volumes: volumes1}: {Volumes: volumes2},
// not the same number of labels
&container.Config{Volumes: volumes1}: {Volumes: volumes3},
{Volumes: volumes1}: {Volumes: volumes3},
}
for config1, config2 := range sameConfigs {
if !compare(config1, config2) {

View file

@ -7,17 +7,17 @@ import (
func TestJSONLogMarshalJSON(t *testing.T) {
logs := map[*JSONLog]string{
&JSONLog{Log: `"A log line with \\"`}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":\".{20,}\"}$`,
&JSONLog{Log: "A log line"}: `^{\"log\":\"A log line\",\"time\":\".{20,}\"}$`,
&JSONLog{Log: "A log line with \r"}: `^{\"log\":\"A log line with \\r\",\"time\":\".{20,}\"}$`,
&JSONLog{Log: "A log line with & < >"}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":\".{20,}\"}$`,
&JSONLog{Log: "A log line with utf8 : 🚀 ψ ω β"}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":\".{20,}\"}$`,
&JSONLog{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":\".{20,}\"}$`,
&JSONLog{}: `^{\"time\":\".{20,}\"}$`,
{Log: `"A log line with \\"`}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":\".{20,}\"}$`,
{Log: "A log line"}: `^{\"log\":\"A log line\",\"time\":\".{20,}\"}$`,
{Log: "A log line with \r"}: `^{\"log\":\"A log line with \\r\",\"time\":\".{20,}\"}$`,
{Log: "A log line with & < >"}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":\".{20,}\"}$`,
{Log: "A log line with utf8 : 🚀 ψ ω β"}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":\".{20,}\"}$`,
{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":\".{20,}\"}$`,
{}: `^{\"time\":\".{20,}\"}$`,
// These ones are a little weird
&JSONLog{Log: "\u2028 \u2029"}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":\".{20,}\"}$`,
&JSONLog{Log: string([]byte{0xaF})}: `^{\"log\":\"\\ufffd\",\"time\":\".{20,}\"}$`,
&JSONLog{Log: string([]byte{0x7F})}: `^{\"log\":\"\x7f\",\"time\":\".{20,}\"}$`,
{Log: "\u2028 \u2029"}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":\".{20,}\"}$`,
{Log: string([]byte{0xaF})}: `^{\"log\":\"\\ufffd\",\"time\":\".{20,}\"}$`,
{Log: string([]byte{0x7F})}: `^{\"log\":\"\x7f\",\"time\":\".{20,}\"}$`,
}
for jsonLog, expression := range logs {
data, err := jsonLog.MarshalJSON()

View file

@ -8,21 +8,21 @@ import (
func TestJSONLogsMarshalJSONBuf(t *testing.T) {
logs := map[*JSONLogs]string{
&JSONLogs{Log: []byte(`"A log line with \\"`)}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line with \r")}: `^{\"log\":\"A log line with \\r\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line with & < >")}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line with utf8 : 🚀 ψ ω β")}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":}$`,
&JSONLogs{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":}$`,
&JSONLogs{Stream: "stdout", Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"stream\":\"stdout\",\"time\":}$`,
&JSONLogs{Created: "time"}: `^{\"time\":time}$`,
&JSONLogs{}: `^{\"time\":}$`,
{Log: []byte(`"A log line with \\"`)}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":}$`,
{Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"time\":}$`,
{Log: []byte("A log line with \r")}: `^{\"log\":\"A log line with \\r\",\"time\":}$`,
{Log: []byte("A log line with & < >")}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":}$`,
{Log: []byte("A log line with utf8 : 🚀 ψ ω β")}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":}$`,
{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":}$`,
{Stream: "stdout", Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"stream\":\"stdout\",\"time\":}$`,
{Created: "time"}: `^{\"time\":time}$`,
{}: `^{\"time\":}$`,
// These ones are a little weird
&JSONLogs{Log: []byte("\u2028 \u2029")}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":}$`,
&JSONLogs{Log: []byte{0xaF}}: `^{\"log\":\"\\ufffd\",\"time\":}$`,
&JSONLogs{Log: []byte{0x7F}}: `^{\"log\":\"\x7f\",\"time\":}$`,
{Log: []byte("\u2028 \u2029")}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":}$`,
{Log: []byte{0xaF}}: `^{\"log\":\"\\ufffd\",\"time\":}$`,
{Log: []byte{0x7F}}: `^{\"log\":\"\x7f\",\"time\":}$`,
// with raw attributes
&JSONLogs{Log: []byte("A log line"), RawAttrs: []byte(`{"hello":"world","value":1234}`)}: `^{\"log\":\"A log line\",\"attrs\":{\"hello\":\"world\",\"value\":1234},\"time\":}$`,
{Log: []byte("A log line"), RawAttrs: []byte(`{"hello":"world","value":1234}`)}: `^{\"log\":\"A log line\",\"attrs\":{\"hello\":\"world\",\"value\":1234},\"time\":}$`,
}
for jsonLog, expression := range logs {
var buf bytes.Buffer

View file

@ -167,11 +167,11 @@ func TestPidModeTest(t *testing.T) {
func TestRestartPolicy(t *testing.T) {
restartPolicies := map[container.RestartPolicy][]bool{
// none, always, failure
container.RestartPolicy{}: {true, false, false},
container.RestartPolicy{Name: "something", MaximumRetryCount: 0}: {false, false, false},
container.RestartPolicy{Name: "no", MaximumRetryCount: 0}: {true, false, false},
container.RestartPolicy{Name: "always", MaximumRetryCount: 0}: {false, true, false},
container.RestartPolicy{Name: "on-failure", MaximumRetryCount: 0}: {false, false, true},
{}: {true, false, false},
{Name: "something", MaximumRetryCount: 0}: {false, false, false},
{Name: "no", MaximumRetryCount: 0}: {true, false, false},
{Name: "always", MaximumRetryCount: 0}: {false, true, false},
{Name: "on-failure", MaximumRetryCount: 0}: {false, false, true},
}
for restartPolicy, state := range restartPolicies {
if restartPolicy.IsNone() != state[0] {