diff --git a/cli/compose/convert/compose.go b/cli/compose/convert/compose.go index 03b8e382cc..03f4524d6b 100644 --- a/cli/compose/convert/compose.go +++ b/cli/compose/convert/compose.go @@ -62,7 +62,7 @@ func Networks(namespace Namespace, networks networkMap, servicesNetworks map[str for internalName := range servicesNetworks { network := networks[internalName] if network.External.External { - externalNetworks = append(externalNetworks, network.External.Name) + externalNetworks = append(externalNetworks, network.Name) continue } diff --git a/cli/compose/convert/compose_test.go b/cli/compose/convert/compose_test.go index bde0942069..1392fce604 100644 --- a/cli/compose/convert/compose_test.go +++ b/cli/compose/convert/compose_test.go @@ -55,10 +55,8 @@ func TestNetworks(t *testing.T) { }, }, "outside": composetypes.NetworkConfig{ - External: composetypes.External{ - External: true, - Name: "special", - }, + External: composetypes.External{External: true}, + Name: "special", }, "attachablenet": composetypes.NetworkConfig{ Driver: "overlay", diff --git a/cli/compose/convert/service.go b/cli/compose/convert/service.go index e58c241c22..cddedd8c0c 100644 --- a/cli/compose/convert/service.go +++ b/cli/compose/convert/service.go @@ -230,7 +230,7 @@ func convertServiceNetworks( } target := namespace.Scope(networkName) if networkConfig.External.External { - target = networkConfig.External.Name + target = networkConfig.Name } netAttachConfig := swarm.NetworkAttachmentConfig{ Target: target, diff --git a/cli/compose/convert/service_test.go b/cli/compose/convert/service_test.go index 265937339f..0f32997077 100644 --- a/cli/compose/convert/service_test.go +++ b/cli/compose/convert/service_test.go @@ -219,10 +219,8 @@ func TestConvertServiceNetworksOnlyDefault(t *testing.T) { func TestConvertServiceNetworks(t *testing.T) { networkConfigs := networkMap{ "front": composetypes.NetworkConfig{ - External: composetypes.External{ - External: true, - Name: "fronttier", - }, + External: composetypes.External{External: true}, + Name: "fronttier", }, "back": composetypes.NetworkConfig{}, } @@ -259,10 +257,8 @@ func TestConvertServiceNetworks(t *testing.T) { func TestConvertServiceNetworksCustomDefault(t *testing.T) { networkConfigs := networkMap{ "default": composetypes.NetworkConfig{ - External: composetypes.External{ - External: true, - Name: "custom", - }, + External: composetypes.External{External: true}, + Name: "custom", }, } networks := map[string]*composetypes.ServiceNetworkConfig{}