diff --git a/cli/app/app.go b/cli/app/app.go index 95f99749..069144b6 100644 --- a/cli/app/app.go +++ b/cli/app/app.go @@ -855,7 +855,7 @@ func loadComposeFile(file string, opt convertOptions) KomposeObject { // transform composeObject into komposeObject composeServiceNames := composeObject.ServiceConfigs.Keys() - // volume config and network config has not supported + // volume config and network config are not supported if len(composeObject.NetworkConfigs) > 0 { logrus.Warningf("Unsupported network configuration of compose v2 - ignoring") } @@ -863,15 +863,15 @@ func loadComposeFile(file string, opt convertOptions) KomposeObject { logrus.Warningf("Unsupported volume configuration of compose v2 - ignoring") } - count := 0 + networksWarningFound := false for _, name := range composeServiceNames { if composeServiceConfig, ok := composeObject.ServiceConfigs.Get(name); ok { //FIXME: networks always contains one default element, even it isn't declared in compose v2. if len(composeServiceConfig.Networks.Networks) > 0 && - strings.Compare(composeServiceConfig.Networks.Networks[0].Name, "default") != 0 && - count == 0 { + composeServiceConfig.Networks.Networks[0].Name != "default" && + !networksWarningFound { logrus.Warningf("Unsupported key networks - ignoring") - count++ + networksWarningFound = true } checkUnsupportedKey(composeServiceConfig) serviceConfig := ServiceConfig{} @@ -1182,7 +1182,7 @@ func Convert(c *cli.Context) { func checkUnsupportedKey(service interface{}) { s := structs.New(service) for _, f := range s.Fields() { - if f.IsExported() && !f.IsZero() && strings.Compare(f.Name(), "Networks") != 0 { + if f.IsExported() && !f.IsZero() && f.Name() != "Networks" { if count, ok := unsupportedKey[f.Name()]; ok && count == 0 { logrus.Warningf("Unsupported key %s - ignoring", composeOptions[f.Name()]) unsupportedKey[f.Name()]++