diff --git a/cmd/analyze.go b/cmd/analyze.go index 3753ad6..b7eeefc 100644 --- a/cmd/analyze.go +++ b/cmd/analyze.go @@ -29,15 +29,15 @@ import ( var ( // application source path inside the container - SourceMountPath = filepath.Join(InputPath, "source") + SourceMountPath = path.Join(InputPath, "source") // analyzer config files - ConfigMountPath = filepath.Join(InputPath, "config") + ConfigMountPath = path.Join(InputPath, "config") // user provided rules path - RulesMountPath = filepath.Join(RulesetPath, "input") + RulesMountPath = path.Join(RulesetPath, "input") // paths to files in the container - AnalysisOutputMountPath = filepath.Join(OutputPath, "output.yaml") - DepsOutputMountPath = filepath.Join(OutputPath, "dependencies.yaml") - ProviderSettingsMountPath = filepath.Join(ConfigMountPath, "settings.json") + AnalysisOutputMountPath = path.Join(OutputPath, "output.yaml") + DepsOutputMountPath = path.Join(OutputPath, "dependencies.yaml") + ProviderSettingsMountPath = path.Join(ConfigMountPath, "settings.json") ) // kantra analyze flags @@ -170,7 +170,7 @@ func (a *analyzeCommand) Validate() error { return fmt.Errorf("%w failed to get absolute path for input file %s", err, a.input) } // make sure we mount a file and not a dir - SourceMountPath = filepath.Join(SourceMountPath, filepath.Base(a.input)) + SourceMountPath = path.Join(SourceMountPath, filepath.Base(a.input)) a.isFileInput = true } if a.mode != string(provider.FullAnalysisMode) && @@ -436,7 +436,7 @@ func (a *analyzeCommand) getRulesVolumes() (map[string]string, error) { } } else { - rulesVolumes[r] = filepath.Join(RulesMountPath, filepath.Base(r)) + rulesVolumes[r] = path.Join(RulesMountPath, filepath.Base(r)) } } if rulesetNeeded { @@ -446,7 +446,7 @@ func (a *analyzeCommand) getRulesVolumes() (map[string]string, error) { a.log.V(1).Error(err, "failed to create temp ruleset", "path", tempRulesetPath) return nil, err } - rulesVolumes[tempDir] = filepath.Join(RulesMountPath, filepath.Base(tempDir)) + rulesVolumes[tempDir] = path.Join(RulesMountPath, filepath.Base(tempDir)) } return rulesVolumes, nil } @@ -494,7 +494,7 @@ func (a *analyzeCommand) RunAnalysis(ctx context.Context, xmlOutputDir string) e } if xmlOutputDir != "" { - convertPath := filepath.Join(RulesetPath, "convert") + convertPath := path.Join(RulesetPath, "convert") volumes[xmlOutputDir] = convertPath // for cleanup purposes a.tempDirs = append(a.tempDirs, xmlOutputDir) @@ -593,7 +593,7 @@ func (a *analyzeCommand) GenerateStaticReport(ctx context.Context) error { args := []string{ fmt.Sprintf("--analysis-output-list=%s", AnalysisOutputMountPath), fmt.Sprintf("--deps-output-list=%s", DepsOutputMountPath), - fmt.Sprintf("--output-path=%s", filepath.Join("/usr/local/static-report/output.js")), + fmt.Sprintf("--output-path=%s", path.Join("/usr/local/static-report/output.js")), fmt.Sprintf("--application-name-list=%s", filepath.Base(a.input)), } @@ -712,7 +712,7 @@ func (a *analyzeCommand) getXMLRulesVolumes(tempRuleDir string) (map[string]stri return nil, err } } else { - rulesVolumes[r] = filepath.Join(XMLRulePath, filepath.Base(r)) + rulesVolumes[r] = path.Join(XMLRulePath, filepath.Base(r)) } } if mountTempDir { diff --git a/cmd/container.go b/cmd/container.go index 0e2ead8..6ad9185 100644 --- a/cmd/container.go +++ b/cmd/container.go @@ -8,7 +8,7 @@ import ( "math/rand" "os" "os/exec" - "path/filepath" + "path" "runtime" "strings" "time" @@ -169,10 +169,10 @@ func (c *container) Run(ctx context.Context, opts ...Option) error { // TODO: check this on windows if os == "linux" { args = append(args, fmt.Sprintf("%s:%s:Z", - filepath.Clean(sourcePath), filepath.Clean(destPath))) + path.Clean(sourcePath), path.Clean(destPath))) } else { args = append(args, fmt.Sprintf("%s:%s", - filepath.Clean(sourcePath), filepath.Clean(destPath))) + path.Clean(sourcePath), path.Clean(destPath))) } } for k, v := range c.env { diff --git a/cmd/shimconvert.go b/cmd/shimconvert.go index a54333e..e752987 100644 --- a/cmd/shimconvert.go +++ b/cmd/shimconvert.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "os" + "path" "path/filepath" "strings" @@ -108,7 +109,7 @@ func (w *windupShimCommand) getRulesVolumes(tempRuleDir string) (map[string]stri return nil, err } } else { - rulesVolumes[r] = filepath.Join(XMLRulePath, filepath.Base(r)) + rulesVolumes[r] = path.Join(XMLRulePath, filepath.Base(r)) } } if mountTempDir {