diff --git a/pkg/handlingfiles/handlingfiles.go b/pkg/handlingfiles/handlingfiles.go index 5446f72..ec3170d 100644 --- a/pkg/handlingfiles/handlingfiles.go +++ b/pkg/handlingfiles/handlingfiles.go @@ -1,8 +1,10 @@ package findfile import ( + "log" "os" "path/filepath" + "regexp" ) var ( @@ -14,6 +16,7 @@ var ( absPathDeploy []string absPathService []string absPathEndpoint []string + DeployPath []string ) func FindFileAbsPathPods(d, filename string) ([]string, error) { @@ -176,7 +179,7 @@ func FindFileAbsPathSTS(d, filename string) ([]string, error) { return absPathSTS, nil } -/* TRY TO MAKE IT WORK AS A GLOBAL FUNC FOR ALL THE FILES +// TRY TO MAKE IT WORK AS A GLOBAL FUNC FOR ALL THE FILES func FindFile(filename, d string) []string { filepath.Walk(d, func(path string, f os.FileInfo, _ error) error { if !f.IsDir() { @@ -187,15 +190,13 @@ func FindFile(filename, d string) []string { log.Fatal(err) } - files = append(files, absolutefilepath) + DeployPath = append(DeployPath, absolutefilepath) } } return nil }) - return files + return DeployPath } - -*/ diff --git a/pkg/resources/deployment.go b/pkg/resources/deployment.go index 3e04ef4..0bd6cf7 100644 --- a/pkg/resources/deployment.go +++ b/pkg/resources/deployment.go @@ -12,12 +12,15 @@ import ( func Deployment() { w := new(tabwriter.Writer) - w.Init(os.Stdout, 8, 8, 0, '\t', 0) + w.Init(os.Stdout, 10, 10, 0, ' ', 0) defer w.Flush() - abspath, _ := handlingfiles.FindFileAbsPathDeploy(extract.Destination, "deployments.json") + //abspath, _ := handlingfiles.FindFileAbsPathDeploy(extract.Destination, "deployments.json") + deploypath := handlingfiles.FindFile("deployments.json", extract.Destination) - for _, f := range abspath { + //for _, f := range abspath { + + for _, f := range deploypath { if f == extract.Destination+"/kube-system/deployments.json" { break }