Skip to content
Snippets Groups Projects
Commit c86d0ff8 authored by Philippe ALEXANDRE's avatar Philippe ALEXANDRE
Browse files

Replace fmt.Sprintf by filepath.Join

parent c808d952
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,8 @@ package cmd ...@@ -17,7 +17,8 @@ package cmd
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"path/filepath"
"github.com/aquasecurity/kube-bench/check" "github.com/aquasecurity/kube-bench/check"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/spf13/viper" "github.com/spf13/viper"
...@@ -47,9 +48,12 @@ func runChecks(t check.NodeType) { ...@@ -47,9 +48,12 @@ func runChecks(t check.NodeType) {
} }
ver := getKubeVersion() ver := getKubeVersion()
path := fmt.Sprintf("%s/%s", cfgDir, ver) // path := fmt.Sprintf("%s/%s", cfgDir, ver)
path := filepath.Join(cfgDir, ver)
def := fmt.Sprintf("%s/%s", path, file)
// def := fmt.Sprintf("%s/%s", path, file)
def := filepath.Join(path, file)
in, err := ioutil.ReadFile(def) in, err := ioutil.ReadFile(def)
if err != nil { if err != nil {
exitWithError(fmt.Errorf("error opening %s controls file: %v", t, err)) exitWithError(fmt.Errorf("error opening %s controls file: %v", t, err))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment