Merge pull request #131969 from skitt/test-e2e-pkg-errors

test: drop dependency on github.com/pkg/errors
This commit is contained in:
Kubernetes Prow Robot
2025-06-04 12:16:38 -07:00
committed by GitHub
5 changed files with 27 additions and 7 deletions

View File

@@ -246,7 +246,7 @@ linters:
# pointerPolicy: SuggestFix # Defaults to `SuggestFix`. We want our required fields to not be pointers.
depguard:
rules:
main:
go-cmp:
files:
- $all
- "!$test"
@@ -254,6 +254,13 @@ linters:
deny:
- pkg: "github.com/google/go-cmp/cmp"
desc: "cmp is allowed only in test files"
pkg-errors:
files:
- $all
- "!**/cmd/kubeadm/**"
deny:
- pkg: "github.com/pkg/errors"
desc: "pkg/errors is allowed only in cmd/kubeadm"
forbidigo:
analyze-types: true
forbid:

View File

@@ -260,7 +260,7 @@ linters:
# pointerPolicy: SuggestFix # Defaults to `SuggestFix`. We want our required fields to not be pointers.
depguard:
rules:
main:
go-cmp:
files:
- $all
- "!$test"
@@ -268,6 +268,13 @@ linters:
deny:
- pkg: "github.com/google/go-cmp/cmp"
desc: "cmp is allowed only in test files"
pkg-errors:
files:
- $all
- "!**/cmd/kubeadm/**"
deny:
- pkg: "github.com/pkg/errors"
desc: "pkg/errors is allowed only in cmd/kubeadm"
forbidigo:
analyze-types: true
forbid:

View File

@@ -190,7 +190,7 @@ linters:
{{include "hack/kube-api-linter/kube-api-linter.yaml" | indent 10 | trim}}
depguard:
rules:
main:
go-cmp:
files:
- $all
- "!$test"
@@ -198,6 +198,13 @@ linters:
deny:
- pkg: "github.com/google/go-cmp/cmp"
desc: "cmp is allowed only in test files"
pkg-errors:
files:
- $all
- "!**/cmd/kubeadm/**"
deny:
- pkg: "github.com/pkg/errors"
desc: "pkg/errors is allowed only in cmd/kubeadm"
forbidigo:
analyze-types: true
forbid:

View File

@@ -29,7 +29,6 @@ import (
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"github.com/pkg/errors"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
v1 "k8s.io/api/core/v1"
@@ -165,7 +164,7 @@ func extractObservedBackoff(ctx context.Context, f *framework.Framework, podName
}
}
}
return r, errors.Errorf("Could not find container status for container %s in pod %s", containerName, podName)
return r, fmt.Errorf("Could not find container status for container %s in pod %s", containerName, podName)
}
func newFailAlwaysPod() *v1.Pod {

View File

@@ -21,6 +21,7 @@ package e2enode
import (
"context"
"errors"
"fmt"
"strings"
"sync"
@@ -28,7 +29,6 @@ import (
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -357,7 +357,7 @@ type pulledStruct struct {
func getDurationsFromPulledEventMsg(msg string) (*pulledStruct, error) {
splits := strings.Split(msg, " ")
if len(splits) != 13 {
return nil, errors.Errorf("pull event message should be spilted to 13: %d", len(splits))
return nil, fmt.Errorf("pull event message should be spilted to 13: %d", len(splits))
}
pulledDuration, err := time.ParseDuration(splits[5])
if err != nil {