From 535f19c5f7ba646d65b951c0733d4cb713b3416f Mon Sep 17 00:00:00 2001 From: Simar Date: Wed, 5 Apr 2023 17:49:08 -0700 Subject: [PATCH] support windows Signed-off-by: Simar --- pkg/fanal/analyzer/config/terraform/terraform_test.go | 3 ++- pkg/misconf/scanner.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/fanal/analyzer/config/terraform/terraform_test.go b/pkg/fanal/analyzer/config/terraform/terraform_test.go index be0eec37034d..357232afffbe 100644 --- a/pkg/fanal/analyzer/config/terraform/terraform_test.go +++ b/pkg/fanal/analyzer/config/terraform/terraform_test.go @@ -3,6 +3,7 @@ package terraform import ( "bytes" "context" + "path/filepath" "testing" "github.com/stretchr/testify/assert" @@ -30,7 +31,7 @@ func TestConfigAnalyzer_Analyze(t *testing.T) { types.MisconfPostHandler: { { Type: types.Terraform, - Path: "path/to/main.tf", + Path: filepath.Clean("path/to/main.tf"), Content: []byte{}, }, }, diff --git a/pkg/misconf/scanner.go b/pkg/misconf/scanner.go index 8bdaa394a451..d71c240d1ba9 100644 --- a/pkg/misconf/scanner.go +++ b/pkg/misconf/scanner.go @@ -247,7 +247,7 @@ func findCommonPrefix(files []types.File) string { func getRootDir(filePath string) (string, error) { var rootDir string - absPath, err := filepath.Abs(filePath) + absPath, err := filepath.Abs(filepath.Clean(filePath)) if err != nil { return "", err }