Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update the go.mod file to fix minor issues #883

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ require (
github.com/BurntSushi/toml v1.0.0
github.com/Masterminds/semver/v3 v3.1.1
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/antchfx/xmlquery v1.3.12
github.com/antchfx/xpath v1.2.1
github.com/argoproj/argo-cd/v2 v2.3.5
github.com/cloudfoundry-community/go-cfclient v0.0.0-20220509215243-5e4f7e9cf503
github.com/cloudfoundry/bosh-cli v6.4.1+incompatible
Expand Down Expand Up @@ -69,8 +71,6 @@ require (
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/antchfx/xmlquery v1.3.12 // indirect
github.com/antchfx/xpath v1.2.1 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect
github.com/argoproj/gitops-engine v0.6.2 // indirect
github.com/argoproj/pkg v0.11.1-0.20211203175135-36c59d8fafe0 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,6 @@ github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TT
github.com/docker/distribution v2.6.0-rc.1.0.20180327202408-83389a148052+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.0+incompatible h1:l9EaZDICImO1ngI+uTifW+ZYvvz7fKISBAKpg+MbWbY=
github.com/docker/distribution v2.8.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v0.0.0-20200511152416-a93e9eb0e95c/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
Expand Down Expand Up @@ -1596,8 +1594,6 @@ github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zM
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.2-0.20211117181255-693428a734f5/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.3-0.20211202222133-eacdcc10569b/go.mod h1:j4h1pJW6ZcJTgMZWP3+7RlG3zTaP02aDZ/Qw0sppK7Q=
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 h1:+czc/J8SlhPKLOtVLMQc+xDCFBT73ZStMsRhSsUhsSg=
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198/go.mod h1:j4h1pJW6ZcJTgMZWP3+7RlG3zTaP02aDZ/Qw0sppK7Q=
github.com/opencontainers/image-spec v1.0.3-0.20220825233605-bc9c4bd9b2a4 h1:7ACimcrIs4exQjkJI4epJCYdgd1WX8AB6UcAKkO4LK8=
github.com/opencontainers/image-spec v1.0.3-0.20220825233605-bc9c4bd9b2a4/go.mod h1:K/JAU0m27RFhDRX4PcFdIKntROP6y5Ed6O91aZYDQfs=
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
Expand Down
46 changes: 26 additions & 20 deletions transformer/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func GetInitializedTransformersF(filters labels.Selector) []Transformer {

// GetServices returns the list of services detected in a directory
func GetServices(prjName string, dir string) (map[string][]plantypes.PlanArtifact, error) {
services := map[string][]plantypes.PlanArtifact{}
planServices := map[string][]plantypes.PlanArtifact{}
logrus.Infoln("Planning started on the base directory")
logrus.Debugf("Transformers: %+v", transformers)
for _, transformer := range transformers {
Expand All @@ -284,30 +284,30 @@ func GetServices(prjName string, dir string) (map[string][]plantypes.PlanArtifac
newServices, err := transformer.DirectoryDetect(env.Encode(dir).(string))
if err != nil {
logrus.Errorf("[%s] Failed . Error: %q", config.Name, err)
} else {
newServices := getPlanArtifactsFromArtifacts(*env.Decode(&newServices).(*map[string][]transformertypes.Artifact), config)
services = plantypes.MergeServices(services, newServices)
if len(newServices) > 0 {
logrus.Infof(getNamedAndUnNamedServicesLogMessage(newServices))
}
common.PlanProgressNumBaseDetectTransformers++
logrus.Infof("[%s] Done", config.Name)
continue
}
newPlanServices := getPlanArtifactsFromArtifacts(*env.Decode(&newServices).(*map[string][]transformertypes.Artifact), config)
planServices = plantypes.MergeServices(planServices, newPlanServices)
if len(newPlanServices) > 0 {
logrus.Infof(getNamedAndUnNamedServicesLogMessage(newPlanServices))
}
common.PlanProgressNumBaseDetectTransformers++
logrus.Infof("[%s] Done", config.Name)
}
logrus.Infof("[Base Directory] %s", getNamedAndUnNamedServicesLogMessage(services))
logrus.Infof("[Base Directory] %s", getNamedAndUnNamedServicesLogMessage(planServices))
logrus.Infoln("Planning finished on the base directory")
logrus.Infoln("Planning started on its sub directories")
nservices, err := walkForServices(dir, services)
nservices, err := walkForServices(dir, planServices)
if err != nil {
logrus.Errorf("Transformation planning - Directory Walk failed : %s", err)
} else {
services = nservices
planServices = nservices
logrus.Infoln("Planning finished on its sub directories")
}
logrus.Infof("[Directory Walk] %s", getNamedAndUnNamedServicesLogMessage(services))
services = nameServices(prjName, services)
logrus.Infof("[Named Services] Identified %d named services", len(services))
return services, nil
logrus.Infof("[Directory Walk] %s", getNamedAndUnNamedServicesLogMessage(planServices))
planServices = nameServices(prjName, planServices)
logrus.Infof("[Named Services] Identified %d named services", len(planServices))
return planServices, nil
}

func walkForServices(inputPath string, bservices map[string][]plantypes.PlanArtifact) (map[string][]plantypes.PlanArtifact, error) {
Expand Down Expand Up @@ -370,10 +370,16 @@ func walkForServices(inputPath string, bservices map[string][]plantypes.PlanArti
newPlanServices := getPlanArtifactsFromArtifacts(*env.Decode(&newServicesToArtifacts).(*map[string][]transformertypes.Artifact), config)
services = plantypes.MergeServices(services, newPlanServices)
logrus.Debugf("[%s] Done", config.Name)
numfound += len(newServicesToArtifacts)
if len(newServicesToArtifacts) > 0 {
relpath, _ := filepath.Rel(inputPath, path)
logrus.Infof("%s in %s", getNamedAndUnNamedServicesLogMessage(newPlanServices), relpath)
numfound += len(newPlanServices)
if len(newPlanServices) > 0 {
msg := getNamedAndUnNamedServicesLogMessage(newPlanServices)
relpath, err := filepath.Rel(inputPath, path)
if err != nil {
logrus.Errorf("failed to make the directory %s relative to the input directory %s . Error: %q", path, inputPath, err)
logrus.Infof("%s in %s", msg, path)
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is only for log, we need not continue, but rather print error and proceed to log.

Copy link
Contributor Author

@HarikrishnanBalagopal HarikrishnanBalagopal Oct 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if it is only for log it should not fail. I have made the change.

}
logrus.Infof("%s in %s", msg, relpath)
}
}
logrus.Debugf("planning finished for the directory %s and %d services were detected", path, numfound)
Expand Down