From c86d0ff81bd85cca1781fbfd9a634276165a9024 Mon Sep 17 00:00:00 2001 From: Philippe ALEXANDRE Date: Fri, 23 Mar 2018 09:27:48 +0100 Subject: [PATCH] Replace fmt.Sprintf by filepath.Join --- cmd/common.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/common.go b/cmd/common.go index 15cb237..3b316a2 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -17,7 +17,8 @@ package cmd import ( "fmt" "io/ioutil" - + "path/filepath" + "github.com/aquasecurity/kube-bench/check" "github.com/golang/glog" "github.com/spf13/viper" @@ -47,9 +48,12 @@ func runChecks(t check.NodeType) { } ver := getKubeVersion() - path := fmt.Sprintf("%s/%s", cfgDir, ver) - - def := fmt.Sprintf("%s/%s", path, file) + // path := fmt.Sprintf("%s/%s", cfgDir, ver) + path := filepath.Join(cfgDir, ver) + + // def := fmt.Sprintf("%s/%s", path, file) + def := filepath.Join(path, file) + in, err := ioutil.ReadFile(def) if err != nil { exitWithError(fmt.Errorf("error opening %s controls file: %v", t, err))