From b5a090e367614c9ddd02bbcefddeb32150cf4e6d Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Wed, 18 Sep 2024 10:45:43 +0200 Subject: [PATCH] fix linters --- .golangci.yaml | 4 +--- cmd/proxy/main.go | 14 ++++++-------- internal/config/config.go | 2 +- internal/e2etest/roundtripper.go | 3 +-- internal/proxy/client.go | 3 +-- internal/proxy/client_test.go | 9 ++++----- 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 18bfd1b..7476544 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -85,10 +85,8 @@ linters-settings: sections: - standard - default - - prefix(cloud-proxy) issues: fix: true -run: - skip-dirs: + exclude-dirs: - mock - internal/castai diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index f216bd5..6cb4133 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -1,24 +1,22 @@ package main import ( - "context" - "fmt" - "net/http" - "path" - "runtime" - "time" - "cloud-proxy/internal/cloud/gcp" "cloud-proxy/internal/cloud/gcp/gcpauth" "cloud-proxy/internal/config" "cloud-proxy/internal/proxy" - + "context" + "fmt" "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" + "net/http" + "path" + "runtime" + "time" ) var ( diff --git a/internal/config/config.go b/internal/config/config.go index 537c5d2..ccbacef 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -22,7 +22,7 @@ type Config struct { PodMetadata PodMetadata `mapstructure:"podmetadata"` // MetricsAddress string `mapstructure:"metricsaddress"` - // HealthAddress string `mapstructure:"healthaddress"` + // HealthAddress string `mapstructure:"healthaddress"`. Log Log `mapstructure:"log"` } diff --git a/internal/e2etest/roundtripper.go b/internal/e2etest/roundtripper.go index 40d2736..bcddab2 100644 --- a/internal/e2etest/roundtripper.go +++ b/internal/e2etest/roundtripper.go @@ -7,9 +7,8 @@ import ( "log" "net/http" - "github.com/google/uuid" - cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" + "github.com/google/uuid" ) type HTTPOverGrpcRoundTripper struct { diff --git a/internal/proxy/client.go b/internal/proxy/client.go index e62c361..28e0d6c 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -12,11 +12,10 @@ import ( "sync/atomic" "time" + cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" "github.com/samber/lo" "github.com/sirupsen/logrus" "google.golang.org/grpc" - - cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" ) const ( diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 138d09b..14046d9 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -13,13 +13,12 @@ import ( "testing" "time" + mock_proxy "cloud-proxy/internal/proxy/mock" + cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" "github.com/golang/mock/gomock" "github.com/samber/lo" "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" - - mock_proxy "cloud-proxy/internal/proxy/mock" - cloudproxyv1alpha "cloud-proxy/proto/gen/proto/v1alpha" ) type mockReadCloserErr struct{} @@ -33,7 +32,7 @@ func TestClient_toResponse(t *testing.T) { t.Parallel() type fields struct { // tuneMockCredentials func(m *mock_gcp.MockCredentials) - // httpClient *http.Client + // httpClient *http.Client. } type args struct { msgID string @@ -86,7 +85,7 @@ func TestClient_toResponse(t *testing.T) { c := New(nil, nil, nil, "podName", "clusterID", "version", time.Second, time.Minute) got := c.toResponse(tt.args.resp) // diff := cmp.Diff(got, tt.want, protocmp.Transform()) - // require.Empty(t, diff) + // require.Empty(t, diff). require.Equal(t, tt.want, got) }) }