Skip to content

Commit

Permalink
fixup! feat: Add golangci-lint
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Feb 22, 2024
1 parent 63a0f36 commit 75944d0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
7 changes: 1 addition & 6 deletions controllers/bsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import (
"fmt"

"github.com/go-logr/logr"
<<<<<<< HEAD
oadpv1alpha1 "github.com/openshift/oadp-operator/api/v1alpha1"
"github.com/openshift/oadp-operator/pkg/common"
"github.com/openshift/oadp-operator/pkg/storage/aws"
=======
>>>>>>> 9a85d2f (feat: Add golangci-lint)
velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -19,6 +13,7 @@ import (

oadpv1alpha1 "github.com/openshift/oadp-operator/api/v1alpha1"
"github.com/openshift/oadp-operator/pkg/common"
"github.com/openshift/oadp-operator/pkg/storage/aws"
)

func (r *DPAReconciler) ValidateBackupStorageLocations(dpa oadpv1alpha1.DataProtectionApplication) (bool, error) {
Expand Down
6 changes: 2 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import (
"fmt"
"os"

"k8s.io/apimachinery/pkg/types"

"k8s.io/client-go/rest"

routev1 "github.com/openshift/api/route/v1"
security "github.com/openshift/api/security/v1"
monitor "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
Expand All @@ -37,13 +33,15 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
Expand Down
6 changes: 3 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"testing"

coreV1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
_ "k8s.io/client-go/plugin/pkg/client/auth"
)
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestAddPodSecurityPrivilegedLabels(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Create a new namespace with the existing labels
namespace := coreV1.Namespace{
namespace := corev1.Namespace{
ObjectMeta: v1.ObjectMeta{
Name: testNamespaceName,
Labels: tt.existingLabels,
Expand Down
5 changes: 2 additions & 3 deletions pkg/storage/aws/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aws

import (
"context"

"errors"

"github.com/aws/aws-sdk-go/aws/endpoints"
Expand All @@ -21,15 +20,15 @@ func BucketRegionIsDiscoverable(bucket string) bool {
func GetBucketRegion(bucket string) (string, error) {
var region string

session, err := session.NewSession()
sessionInstance, err := session.NewSession()
if err != nil {
// return "", errors.WithStack(err) // don't need stack trace, not inside velero-plugin
return "", err
}

for _, partition := range endpoints.DefaultPartitions() {
for regionHint := range partition.Regions() {
region, _ = s3manager.GetBucketRegion(context.Background(), session, bucket, regionHint)
region, _ = s3manager.GetBucketRegion(context.Background(), sessionInstance, bucket, regionHint)

// we only need to try a single region hint per partition, so break after the first
break
Expand Down

0 comments on commit 75944d0

Please sign in to comment.