chore: pkg imported more than once (#2151)

mine
guangwu 2023-07-12 22:04:12 +08:00 committed by GitHub
parent dc06addd27
commit 2d2746af3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -9,7 +9,6 @@ import (
"github.com/derailed/k9s/internal/client"
"github.com/rs/zerolog/log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
@ -134,7 +133,7 @@ func (m *Meta) AllGVRs() client.GVRs {
}
// IsCRD checks if resource represents a CRD
func IsCRD(r v1.APIResource) bool {
func IsCRD(r metav1.APIResource) bool {
for _, c := range r.Categories {
if c == CRD {
return true

View File

@ -8,7 +8,6 @@ import (
"github.com/derailed/k9s/internal/client"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
@ -23,7 +22,7 @@ type ReplicaSet struct {
}
// Load returns a given instance.
func (r *ReplicaSet) Load(f Factory, path string) (*v1.ReplicaSet, error) {
func (r *ReplicaSet) Load(f Factory, path string) (*appsv1.ReplicaSet, error) {
o, err := f.Get("apps/v1/replicasets", path, true, labels.Everything())
if err != nil {
return nil, err
@ -38,7 +37,7 @@ func (r *ReplicaSet) Load(f Factory, path string) (*v1.ReplicaSet, error) {
return &rs, nil
}
func getRSRevision(rs *v1.ReplicaSet) (int64, error) {
func getRSRevision(rs *appsv1.ReplicaSet) (int64, error) {
revision := rs.ObjectMeta.Annotations["deployment.kubernetes.io/revision"]
if rs.Status.Replicas != 0 {
return 0, errors.New("can not rollback current replica")
@ -51,7 +50,7 @@ func getRSRevision(rs *v1.ReplicaSet) (int64, error) {
return int64(vers), nil
}
func controllerInfo(rs *v1.ReplicaSet) (string, string, string, error) {
func controllerInfo(rs *appsv1.ReplicaSet) (string, string, string, error) {
for _, ref := range rs.ObjectMeta.OwnerReferences {
if ref.Controller == nil {
continue