Enable stylecheck linter and resolve found issues.

Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
This commit is contained in:
Xun Jiang
2023-04-25 13:50:52 +08:00
parent 980106dc39
commit bbc1e2e151
40 changed files with 215 additions and 227 deletions

View File

@@ -26,7 +26,6 @@ import (
api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/plugin/framework/common"
proto "github.com/vmware-tanzu/velero/pkg/plugin/generated"
protobiav1 "github.com/vmware-tanzu/velero/pkg/plugin/generated"
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
biav1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/backupitemaction/v1"
)
@@ -52,8 +51,8 @@ func (s *BackupItemActionGRPCServer) getImpl(name string) (biav1.BackupItemActio
}
func (s *BackupItemActionGRPCServer) AppliesTo(
ctx context.Context, req *protobiav1.BackupItemActionAppliesToRequest) (
response *protobiav1.BackupItemActionAppliesToResponse, err error) {
ctx context.Context, req *proto.BackupItemActionAppliesToRequest) (
response *proto.BackupItemActionAppliesToResponse, err error) {
defer func() {
if recoveredErr := common.HandlePanic(recover()); recoveredErr != nil {
err = recoveredErr
@@ -70,7 +69,7 @@ func (s *BackupItemActionGRPCServer) AppliesTo(
return nil, common.NewGRPCError(err)
}
return &protobiav1.BackupItemActionAppliesToResponse{
return &proto.BackupItemActionAppliesToResponse{
ResourceSelector: &proto.ResourceSelector{
IncludedNamespaces: resourceSelector.IncludedNamespaces,
ExcludedNamespaces: resourceSelector.ExcludedNamespaces,
@@ -82,7 +81,7 @@ func (s *BackupItemActionGRPCServer) AppliesTo(
}
func (s *BackupItemActionGRPCServer) Execute(
ctx context.Context, req *protobiav1.ExecuteRequest) (response *protobiav1.ExecuteResponse, err error) {
ctx context.Context, req *proto.ExecuteRequest) (response *proto.ExecuteResponse, err error) {
defer func() {
if recoveredErr := common.HandlePanic(recover()); recoveredErr != nil {
err = recoveredErr
@@ -121,7 +120,7 @@ func (s *BackupItemActionGRPCServer) Execute(
}
}
res := &protobiav1.ExecuteResponse{
res := &proto.ExecuteResponse{
Item: updatedItemJSON,
}

View File

@@ -31,7 +31,6 @@ import (
v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/plugin/framework/common"
proto "github.com/vmware-tanzu/velero/pkg/plugin/generated"
protobiav1 "github.com/vmware-tanzu/velero/pkg/plugin/generated"
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
mocks "github.com/vmware-tanzu/velero/pkg/plugin/velero/mocks/backupitemaction/v1"
velerotest "github.com/vmware-tanzu/velero/pkg/test"
@@ -162,7 +161,7 @@ func TestBackupItemActionGRPCServerExecute(t *testing.T) {
},
}}
req := &protobiav1.ExecuteRequest{
req := &proto.ExecuteRequest{
Plugin: "xyz",
Item: test.item,
Backup: test.backup,

View File

@@ -216,6 +216,6 @@ func backupResourceIdentifierToProto(id velero.ResourceIdentifier) *proto.Resour
// This shouldn't be called on the GRPC server since the server won't ever receive this request, as
// the RestartableBackupItemAction in Velero won't delegate this to the server
func (c *BackupItemActionGRPCServer) Name() string {
func (s *BackupItemActionGRPCServer) Name() string {
return ""
}

View File

@@ -51,7 +51,7 @@ const (
PluginKindPluginLister PluginKind = "PluginLister"
)
// If there are plugin kinds that are adaptable to newer API versions, list them here.
// PluginKindsAdaptableTo if there are plugin kinds that are adaptable to newer API versions, list them here.
// The older (adaptable) version is the key, and the value is the full list of newer
// plugin kinds that are capable of adapting it.
var PluginKindsAdaptableTo = map[PluginKind][]PluginKind{

View File

@@ -266,6 +266,6 @@ func restoreResourceIdentifierToProto(id velero.ResourceIdentifier) *proto.Resou
// This shouldn't be called on the GRPC server since the server won't ever receive this request, as
// the RestartableRestoreItemAction in Velero won't delegate this to the server
func (c *RestoreItemActionGRPCServer) Name() string {
func (s *RestoreItemActionGRPCServer) Name() string {
return ""
}