fix golint failures in test/e2e_node/builder

This commit is contained in:
SataQiu 2019-03-26 14:12:45 +08:00
parent 350dfccfe9
commit b1cb58fdf2
2 changed files with 6 additions and 5 deletions

View File

@ -660,7 +660,6 @@ test/e2e/storage/utils
test/e2e/storage/vsphere
test/e2e_kubeadm
test/e2e_node
test/e2e_node/builder
test/e2e_node/remote
test/e2e_node/runner/remote
test/e2e_node/services

View File

@ -37,11 +37,12 @@ var buildTargets = []string{
"cluster/gce/gci/mounter",
}
// BuildGo builds k8s binaries.
func BuildGo() error {
klog.Infof("Building k8s binaries...")
k8sRoot, err := utils.GetK8sRootDir()
if err != nil {
return fmt.Errorf("failed to locate kubernetes root directory %v.", err)
return fmt.Errorf("failed to locate kubernetes root directory %v", err)
}
targets := strings.Join(buildTargets, " ")
cmd := exec.Command("make", "-C", k8sRoot, fmt.Sprintf("WHAT=%s", targets))
@ -49,7 +50,7 @@ func BuildGo() error {
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
return fmt.Errorf("failed to build go packages %v\n", err)
return fmt.Errorf("failed to build go packages %v", err)
}
return nil
}
@ -62,14 +63,14 @@ func getK8sBin(bin string) (string, error) {
return "", err
}
if _, err := os.Stat(filepath.Join(*k8sBinDir, bin)); err != nil {
return "", fmt.Errorf("Could not find %s under directory %s.", bin, absPath)
return "", fmt.Errorf("Could not find %s under directory %s", bin, absPath)
}
return filepath.Join(absPath, bin), nil
}
path, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
return "", fmt.Errorf("Could not find absolute path of directory containing the tests %s.", filepath.Dir(os.Args[0]))
return "", fmt.Errorf("Could not find absolute path of directory containing the tests %s", filepath.Dir(os.Args[0]))
}
if _, err := os.Stat(filepath.Join(path, bin)); err == nil {
return filepath.Join(path, bin), nil
@ -87,6 +88,7 @@ func getK8sBin(bin string) (string, error) {
return "", fmt.Errorf("unable to locate %s, Can be defined using --k8s-path", bin)
}
// GetKubeletServerBin returns the path of kubelet binary.
func GetKubeletServerBin() string {
bin, err := getK8sBin("kubelet")
if err != nil {