mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
use native error instead of github.com/pkg/errors
Signed-off-by: wangyysde <net_use@bzhy.com>
This commit is contained in:
parent
7b24c7e4a7
commit
e2e1c94f06
@ -21,12 +21,12 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ func checkAllProviders(e2eFile string) error {
|
|||||||
|
|
||||||
fileInput, err := ioutil.ReadFile(e2eFile)
|
fileInput, err := ioutil.ReadFile(e2eFile)
|
||||||
if err != nil {
|
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 := bufio.NewScanner(bytes.NewReader(fileInput))
|
||||||
scanner.Split(bufio.ScanLines)
|
scanner.Split(bufio.ScanLines)
|
||||||
@ -57,7 +57,7 @@ func checkAllProviders(e2eFile string) error {
|
|||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
if regStartConformance.MatchString(line) {
|
if regStartConformance.MatchString(line) {
|
||||||
if inConformanceCode {
|
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
|
inConformanceCode = true
|
||||||
}
|
}
|
||||||
@ -73,10 +73,10 @@ func checkAllProviders(e2eFile string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if inConformanceCode {
|
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 {
|
if checkFailed {
|
||||||
return errors.Errorf("We need to fix the above errors.")
|
return errors.New("We need to fix the above errors.")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ func processFile(e2ePath string) error {
|
|||||||
|
|
||||||
files, err := ioutil.ReadDir(e2ePath)
|
files, err := ioutil.ReadDir(e2ePath)
|
||||||
if err != nil {
|
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 {
|
for _, file := range files {
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
@ -113,7 +113,7 @@ func processDir(e2ePath string) error {
|
|||||||
// Search sub directories if exist
|
// Search sub directories if exist
|
||||||
files, err := ioutil.ReadDir(e2ePath)
|
files, err := ioutil.ReadDir(e2ePath)
|
||||||
if err != nil {
|
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 {
|
for _, file := range files {
|
||||||
if !file.IsDir() {
|
if !file.IsDir() {
|
||||||
|
Loading…
Reference in New Issue
Block a user