mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Format code with gofmt -s from go-1.11beta1
This should eliminate a bunch of new (go-1.11 related) validation errors telling that the code is not formatted with `gofmt -s`. No functional change, just whitespace (i.e. `git show --ignore-space-change` shows nothing). Patch generated with: > git ls-files | grep -v ^vendor/ | grep .go$ | xargs gofmt -s -w Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
7aa797fe92
commit
9b0097a699
14 changed files with 63 additions and 63 deletions
|
@ -29,8 +29,8 @@ func TestStrSliceMarshalJSON(t *testing.T) {
|
||||||
|
|
||||||
func TestStrSliceUnmarshalJSON(t *testing.T) {
|
func TestStrSliceUnmarshalJSON(t *testing.T) {
|
||||||
parts := map[string][]string{
|
parts := map[string][]string{
|
||||||
"": {"default", "values"},
|
"": {"default", "values"},
|
||||||
"[]": {},
|
"[]": {},
|
||||||
`["/bin/sh","-c","echo"]`: {"/bin/sh", "-c", "echo"},
|
`["/bin/sh","-c","echo"]`: {"/bin/sh", "-c", "echo"},
|
||||||
}
|
}
|
||||||
for json, expectedParts := range parts {
|
for json, expectedParts := range parts {
|
||||||
|
|
|
@ -788,7 +788,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
|
||||||
|
|
||||||
for operatingSystem, gd := range d.graphDrivers {
|
for operatingSystem, gd := range d.graphDrivers {
|
||||||
layerStores[operatingSystem], err = layer.NewStoreFromOptions(layer.StoreOptions{
|
layerStores[operatingSystem], err = layer.NewStoreFromOptions(layer.StoreOptions{
|
||||||
Root: config.Root,
|
Root: config.Root,
|
||||||
MetadataStorePathTemplate: filepath.Join(config.Root, "image", "%s", "layerdb"),
|
MetadataStorePathTemplate: filepath.Join(config.Root, "image", "%s", "layerdb"),
|
||||||
GraphDriver: gd,
|
GraphDriver: gd,
|
||||||
GraphDriverOptions: config.GraphOptions,
|
GraphDriverOptions: config.GraphOptions,
|
||||||
|
|
|
@ -156,7 +156,7 @@ func TestNewGELFTCPWriter(t *testing.T) {
|
||||||
"gelf-address": url,
|
"gelf-address": url,
|
||||||
"gelf-tcp-max-reconnect": "0",
|
"gelf-tcp-max-reconnect": "0",
|
||||||
"gelf-tcp-reconnect-delay": "0",
|
"gelf-tcp-reconnect-delay": "0",
|
||||||
"tag": "{{.ID}}",
|
"tag": "{{.ID}}",
|
||||||
},
|
},
|
||||||
ContainerID: "12345678901234567890",
|
ContainerID: "12345678901234567890",
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,10 @@ func TestValidateLogOpt(t *testing.T) {
|
||||||
splunkVerifyConnectionKey: "true",
|
splunkVerifyConnectionKey: "true",
|
||||||
splunkGzipCompressionKey: "true",
|
splunkGzipCompressionKey: "true",
|
||||||
splunkGzipCompressionLevelKey: "1",
|
splunkGzipCompressionLevelKey: "1",
|
||||||
envKey: "a",
|
envKey: "a",
|
||||||
envRegexKey: "^foo",
|
envRegexKey: "^foo",
|
||||||
labelsKey: "b",
|
labelsKey: "b",
|
||||||
tagKey: "c",
|
tagKey: "c",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -251,9 +251,9 @@ func TestInlineFormatWithNonDefaultOptions(t *testing.T) {
|
||||||
splunkIndexKey: "myindex",
|
splunkIndexKey: "myindex",
|
||||||
splunkFormatKey: splunkFormatInline,
|
splunkFormatKey: splunkFormatInline,
|
||||||
splunkGzipCompressionKey: "true",
|
splunkGzipCompressionKey: "true",
|
||||||
tagKey: "{{.ImageName}}/{{.Name}}",
|
tagKey: "{{.ImageName}}/{{.Name}}",
|
||||||
labelsKey: "a",
|
labelsKey: "a",
|
||||||
envRegexKey: "^foo",
|
envRegexKey: "^foo",
|
||||||
},
|
},
|
||||||
ContainerID: "containeriid",
|
ContainerID: "containeriid",
|
||||||
ContainerName: "/container_name",
|
ContainerName: "/container_name",
|
||||||
|
|
|
@ -656,7 +656,7 @@ func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) {
|
||||||
"file2.txt": "test2",
|
"file2.txt": "test2",
|
||||||
"dir/nested_file": "nested file",
|
"dir/nested_file": "nested file",
|
||||||
"dir/nested_dir/nest_nest_file": "2 times nested",
|
"dir/nested_dir/nest_nest_file": "2 times nested",
|
||||||
"dirt": "dirty",
|
"dirt": "dirty",
|
||||||
}))
|
}))
|
||||||
defer ctx.Close()
|
defer ctx.Close()
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
|
||||||
RUN exit 0
|
RUN exit 0
|
||||||
RUN exit 0`,
|
RUN exit 0`,
|
||||||
numberOfIntermediateContainers: 2,
|
numberOfIntermediateContainers: 2,
|
||||||
rm: false,
|
rm: false,
|
||||||
forceRm: false,
|
forceRm: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "successful build with remove",
|
name: "successful build with remove",
|
||||||
|
@ -46,8 +46,8 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
|
||||||
RUN exit 0
|
RUN exit 0
|
||||||
RUN exit 0`,
|
RUN exit 0`,
|
||||||
numberOfIntermediateContainers: 0,
|
numberOfIntermediateContainers: 0,
|
||||||
rm: true,
|
rm: true,
|
||||||
forceRm: false,
|
forceRm: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "successful build with remove and force remove",
|
name: "successful build with remove and force remove",
|
||||||
|
@ -55,8 +55,8 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
|
||||||
RUN exit 0
|
RUN exit 0
|
||||||
RUN exit 0`,
|
RUN exit 0`,
|
||||||
numberOfIntermediateContainers: 0,
|
numberOfIntermediateContainers: 0,
|
||||||
rm: true,
|
rm: true,
|
||||||
forceRm: true,
|
forceRm: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "failed build with no removal",
|
name: "failed build with no removal",
|
||||||
|
@ -64,8 +64,8 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
|
||||||
RUN exit 0
|
RUN exit 0
|
||||||
RUN exit 1`,
|
RUN exit 1`,
|
||||||
numberOfIntermediateContainers: 2,
|
numberOfIntermediateContainers: 2,
|
||||||
rm: false,
|
rm: false,
|
||||||
forceRm: false,
|
forceRm: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "failed build with remove",
|
name: "failed build with remove",
|
||||||
|
@ -73,8 +73,8 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
|
||||||
RUN exit 0
|
RUN exit 0
|
||||||
RUN exit 1`,
|
RUN exit 1`,
|
||||||
numberOfIntermediateContainers: 1,
|
numberOfIntermediateContainers: 1,
|
||||||
rm: true,
|
rm: true,
|
||||||
forceRm: false,
|
forceRm: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "failed build with remove and force remove",
|
name: "failed build with remove and force remove",
|
||||||
|
@ -82,8 +82,8 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
|
||||||
RUN exit 0
|
RUN exit 0
|
||||||
RUN exit 1`,
|
RUN exit 1`,
|
||||||
numberOfIntermediateContainers: 0,
|
numberOfIntermediateContainers: 0,
|
||||||
rm: true,
|
rm: true,
|
||||||
forceRm: true,
|
forceRm: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,9 +168,9 @@ func (c *client) Create(_ context.Context, id string, spec *specs.Spec, runtimeO
|
||||||
func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions interface{}) error {
|
func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions interface{}) error {
|
||||||
logger := c.logger.WithField("container", id)
|
logger := c.logger.WithField("container", id)
|
||||||
configuration := &hcsshim.ContainerConfig{
|
configuration := &hcsshim.ContainerConfig{
|
||||||
SystemType: "Container",
|
SystemType: "Container",
|
||||||
Name: id,
|
Name: id,
|
||||||
Owner: defaultOwner,
|
Owner: defaultOwner,
|
||||||
IgnoreFlushesDuringBoot: spec.Windows.IgnoreFlushesDuringBoot,
|
IgnoreFlushesDuringBoot: spec.Windows.IgnoreFlushesDuringBoot,
|
||||||
HostName: spec.Hostname,
|
HostName: spec.Hostname,
|
||||||
HvPartition: false,
|
HvPartition: false,
|
||||||
|
@ -377,11 +377,11 @@ func (c *client) createLinux(id string, spec *specs.Spec, runtimeOptions interfa
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration := &hcsshim.ContainerConfig{
|
configuration := &hcsshim.ContainerConfig{
|
||||||
HvPartition: true,
|
HvPartition: true,
|
||||||
Name: id,
|
Name: id,
|
||||||
SystemType: "container",
|
SystemType: "container",
|
||||||
ContainerType: "linux",
|
ContainerType: "linux",
|
||||||
Owner: defaultOwner,
|
Owner: defaultOwner,
|
||||||
TerminateOnLastHandleClosed: true,
|
TerminateOnLastHandleClosed: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ func TestMigrateRefs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
expected := map[string]string{
|
expected := map[string]string{
|
||||||
"docker.io/library/busybox:latest": "sha256:fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9",
|
"docker.io/library/busybox:latest": "sha256:fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9",
|
||||||
"docker.io/library/busybox@sha256:16a2a52884c2a9481ed267c2d46483eac7693b813a63132368ab098a71303f8a": "sha256:fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9",
|
"docker.io/library/busybox@sha256:16a2a52884c2a9481ed267c2d46483eac7693b813a63132368ab098a71303f8a": "sha256:fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9",
|
||||||
"docker.io/library/registry:2": "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae",
|
"docker.io/library/registry:2": "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae",
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(expected, ta.refs) {
|
if !reflect.DeepEqual(expected, ta.refs) {
|
||||||
|
|
|
@ -69,18 +69,18 @@ func TestParseDockerDaemonHost(t *testing.T) {
|
||||||
"[::1]:5555/path": "tcp://[::1]:5555/path",
|
"[::1]:5555/path": "tcp://[::1]:5555/path",
|
||||||
"[0:0:0:0:0:0:0:1]:": "tcp://[0:0:0:0:0:0:0:1]:2375",
|
"[0:0:0:0:0:0:0:1]:": "tcp://[0:0:0:0:0:0:0:1]:2375",
|
||||||
"[0:0:0:0:0:0:0:1]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path",
|
"[0:0:0:0:0:0:0:1]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path",
|
||||||
":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost),
|
":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost),
|
||||||
":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost),
|
":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost),
|
||||||
"tcp://": DefaultTCPHost,
|
"tcp://": DefaultTCPHost,
|
||||||
"tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost),
|
"tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost),
|
||||||
"tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost),
|
"tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost),
|
||||||
"unix:///run/docker.sock": "unix:///run/docker.sock",
|
"unix:///run/docker.sock": "unix:///run/docker.sock",
|
||||||
"unix://": "unix://" + DefaultUnixSocket,
|
"unix://": "unix://" + DefaultUnixSocket,
|
||||||
"fd://": "fd://",
|
"fd://": "fd://",
|
||||||
"fd://something": "fd://something",
|
"fd://something": "fd://something",
|
||||||
"localhost:": "tcp://localhost:2375",
|
"localhost:": "tcp://localhost:2375",
|
||||||
"localhost:5555": "tcp://localhost:5555",
|
"localhost:5555": "tcp://localhost:5555",
|
||||||
"localhost:5555/path": "tcp://localhost:5555/path",
|
"localhost:5555/path": "tcp://localhost:5555/path",
|
||||||
}
|
}
|
||||||
for invalidAddr, expectedError := range invalids {
|
for invalidAddr, expectedError := range invalids {
|
||||||
if addr, err := parseDaemonHost(invalidAddr); err == nil || err.Error() != expectedError {
|
if addr, err := parseDaemonHost(invalidAddr); err == nil || err.Error() != expectedError {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
|
|
||||||
func TestPeerCertificateMarshalJSON(t *testing.T) {
|
func TestPeerCertificateMarshalJSON(t *testing.T) {
|
||||||
template := &x509.Certificate{
|
template := &x509.Certificate{
|
||||||
IsCA: true,
|
IsCA: true,
|
||||||
BasicConstraintsValid: true,
|
BasicConstraintsValid: true,
|
||||||
SubjectKeyId: []byte{1, 2, 3},
|
SubjectKeyId: []byte{1, 2, 3},
|
||||||
SerialNumber: big.NewInt(1234),
|
SerialNumber: big.NewInt(1234),
|
||||||
|
|
|
@ -144,7 +144,7 @@ func TestDrainBody(t *testing.T) {
|
||||||
length int // length is the message length send to drainBody
|
length int // length is the message length send to drainBody
|
||||||
expectedBodyLength int // expectedBodyLength is the expected body length after drainBody is called
|
expectedBodyLength int // expectedBodyLength is the expected body length after drainBody is called
|
||||||
}{
|
}{
|
||||||
{10, 10}, // Small message size
|
{10, 10}, // Small message size
|
||||||
{maxBodySize - 1, maxBodySize - 1}, // Max message size
|
{maxBodySize - 1, maxBodySize - 1}, // Max message size
|
||||||
{maxBodySize * 2, 0}, // Large message size (skip copying body)
|
{maxBodySize * 2, 0}, // Large message size (skip copying body)
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
saveLoadTestCases = map[string]digest.Digest{
|
saveLoadTestCases = map[string]digest.Digest{
|
||||||
"registry:5000/foobar:HEAD": "sha256:470022b8af682154f57a2163d030eb369549549cba00edc69e1b99b46bb924d6",
|
"registry:5000/foobar:HEAD": "sha256:470022b8af682154f57a2163d030eb369549549cba00edc69e1b99b46bb924d6",
|
||||||
"registry:5000/foobar:alternate": "sha256:ae300ebc4a4f00693702cfb0a5e0b7bc527b353828dc86ad09fb95c8a681b793",
|
"registry:5000/foobar:alternate": "sha256:ae300ebc4a4f00693702cfb0a5e0b7bc527b353828dc86ad09fb95c8a681b793",
|
||||||
"registry:5000/foobar:latest": "sha256:6153498b9ac00968d71b66cca4eac37e990b5f9eb50c26877eb8799c8847451b",
|
"registry:5000/foobar:latest": "sha256:6153498b9ac00968d71b66cca4eac37e990b5f9eb50c26877eb8799c8847451b",
|
||||||
"registry:5000/foobar:master": "sha256:6c9917af4c4e05001b346421959d7ea81b6dc9d25718466a37a6add865dfd7fc",
|
"registry:5000/foobar:master": "sha256:6c9917af4c4e05001b346421959d7ea81b6dc9d25718466a37a6add865dfd7fc",
|
||||||
"jess/hollywood:latest": "sha256:ae7a5519a0a55a2d4ef20ddcbd5d0ca0888a1f7ab806acc8e2a27baf46f529fe",
|
"jess/hollywood:latest": "sha256:ae7a5519a0a55a2d4ef20ddcbd5d0ca0888a1f7ab806acc8e2a27baf46f529fe",
|
||||||
"registry@sha256:367eb40fd0330a7e464777121e39d2f5b3e8e23a1e159342e53ab05c9e4d94e6": "sha256:24126a56805beb9711be5f4590cc2eb55ab8d4a85ebd618eed72bb19fc50631c",
|
"registry@sha256:367eb40fd0330a7e464777121e39d2f5b3e8e23a1e159342e53ab05c9e4d94e6": "sha256:24126a56805beb9711be5f4590cc2eb55ab8d4a85ebd618eed72bb19fc50631c",
|
||||||
"busybox:latest": "sha256:91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
|
"busybox:latest": "sha256:91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (s *DefaultService) lookupV2Endpoints(hostname string) (endpoints []APIEndp
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: hostname,
|
Host: hostname,
|
||||||
},
|
},
|
||||||
Version: APIVersion2,
|
Version: APIVersion2,
|
||||||
AllowNondistributableArtifacts: ana,
|
AllowNondistributableArtifacts: ana,
|
||||||
TrimHostname: true,
|
TrimHostname: true,
|
||||||
TLSConfig: tlsConfig,
|
TLSConfig: tlsConfig,
|
||||||
|
@ -70,7 +70,7 @@ func (s *DefaultService) lookupV2Endpoints(hostname string) (endpoints []APIEndp
|
||||||
Scheme: "http",
|
Scheme: "http",
|
||||||
Host: hostname,
|
Host: hostname,
|
||||||
},
|
},
|
||||||
Version: APIVersion2,
|
Version: APIVersion2,
|
||||||
AllowNondistributableArtifacts: ana,
|
AllowNondistributableArtifacts: ana,
|
||||||
TrimHostname: true,
|
TrimHostname: true,
|
||||||
// used to check if supposed to be secure via InsecureSkipVerify
|
// used to check if supposed to be secure via InsecureSkipVerify
|
||||||
|
|
|
@ -22,20 +22,20 @@ func TestNetworkModeTest(t *testing.T) {
|
||||||
"something:weird": {true, false, false, false, false, false},
|
"something:weird": {true, false, false, false, false, false},
|
||||||
"bridge": {true, true, false, false, false, false},
|
"bridge": {true, true, false, false, false, false},
|
||||||
DefaultDaemonNetworkMode(): {true, true, false, false, false, false},
|
DefaultDaemonNetworkMode(): {true, true, false, false, false, false},
|
||||||
"host": {false, false, true, false, false, false},
|
"host": {false, false, true, false, false, false},
|
||||||
"container:name": {false, false, false, true, false, false},
|
"container:name": {false, false, false, true, false, false},
|
||||||
"none": {true, false, false, false, true, false},
|
"none": {true, false, false, false, true, false},
|
||||||
"default": {true, false, false, false, false, true},
|
"default": {true, false, false, false, false, true},
|
||||||
}
|
}
|
||||||
networkModeNames := map[container.NetworkMode]string{
|
networkModeNames := map[container.NetworkMode]string{
|
||||||
"": "",
|
"": "",
|
||||||
"something:weird": "something:weird",
|
"something:weird": "something:weird",
|
||||||
"bridge": "bridge",
|
"bridge": "bridge",
|
||||||
DefaultDaemonNetworkMode(): "bridge",
|
DefaultDaemonNetworkMode(): "bridge",
|
||||||
"host": "host",
|
"host": "host",
|
||||||
"container:name": "container",
|
"container:name": "container",
|
||||||
"none": "none",
|
"none": "none",
|
||||||
"default": "default",
|
"default": "default",
|
||||||
}
|
}
|
||||||
for networkMode, state := range networkModes {
|
for networkMode, state := range networkModes {
|
||||||
if networkMode.IsPrivate() != state[0] {
|
if networkMode.IsPrivate() != state[0] {
|
||||||
|
|
Loading…
Add table
Reference in a new issue