mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #103118 from wangyysde/remove-errors-from-check_conformance_test_requirements.go
use native error instead of github.com/pkg/errors
This commit is contained in:
commit
7e00f5d401
@ -21,12 +21,12 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -48,7 +48,7 @@ func checkAllProviders(e2eFile string) error {
|
||||
|
||||
fileInput, err := ioutil.ReadFile(e2eFile)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to read file %s", e2eFile)
|
||||
return fmt.Errorf("Failed to read file %s: %w", e2eFile, err)
|
||||
}
|
||||
scanner := bufio.NewScanner(bytes.NewReader(fileInput))
|
||||
scanner.Split(bufio.ScanLines)
|
||||
@ -57,7 +57,7 @@ func checkAllProviders(e2eFile string) error {
|
||||
line := scanner.Text()
|
||||
if regStartConformance.MatchString(line) {
|
||||
if inConformanceCode {
|
||||
return errors.Errorf("Missed the end of previous conformance test. There might be a bug in this script.")
|
||||
return errors.New("Missed the end of previous conformance test. There might be a bug in this script.")
|
||||
}
|
||||
inConformanceCode = true
|
||||
}
|
||||
@ -73,10 +73,10 @@ func checkAllProviders(e2eFile string) error {
|
||||
}
|
||||
}
|
||||
if inConformanceCode {
|
||||
return errors.Errorf("Missed the end of previous conformance test. There might be a bug in this script.")
|
||||
return errors.New("Missed the end of previous conformance test. There might be a bug in this script.")
|
||||
}
|
||||
if checkFailed {
|
||||
return errors.Errorf("We need to fix the above errors.")
|
||||
return errors.New("We need to fix the above errors.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -86,7 +86,7 @@ func processFile(e2ePath string) error {
|
||||
|
||||
files, err := ioutil.ReadDir(e2ePath)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to read dir %s", e2ePath)
|
||||
return fmt.Errorf("Failed to read dir %s: %w", e2ePath, err)
|
||||
}
|
||||
for _, file := range files {
|
||||
if file.IsDir() {
|
||||
@ -113,7 +113,7 @@ func processDir(e2ePath string) error {
|
||||
// Search sub directories if exist
|
||||
files, err := ioutil.ReadDir(e2ePath)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to read dir %s", e2ePath)
|
||||
return fmt.Errorf("Failed to read dir %s: %w", e2ePath, err)
|
||||
}
|
||||
for _, file := range files {
|
||||
if !file.IsDir() {
|
||||
|
Loading…
Reference in New Issue
Block a user