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

View file

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

View file

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

View file

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

View file

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