Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
pasha-codefresh committed Sep 23, 2024
1 parent 544d111 commit f5a1f50
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 35 deletions.
3 changes: 2 additions & 1 deletion acr_controller/application/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
"strings"
"time"

appclient "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
"google.golang.org/grpc"

appclient "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
)

//go:generate go run github.com/vektra/mockery/[email protected] --name=ApplicationClient
Expand Down
6 changes: 4 additions & 2 deletions acr_controller/controller/broadcaster.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package application_change_revision_controller

import (
appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"sync"

Check failure on line 4 in acr_controller/controller/broadcaster.go

View workflow job for this annotation

GitHub Actions / Lint Go code

other declaration of sync (typecheck)

"sync"

Check failure on line 6 in acr_controller/controller/broadcaster.go

View workflow job for this annotation

GitHub Actions / Lint Go code

`sync` redeclared in this block (typecheck)

log "github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/watch"
"sync"
)

type subscriber struct {
Expand Down
16 changes: 5 additions & 11 deletions acr_controller/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@ package application_change_revision_controller

import (
"context"
"time"

appclient "github.com/argoproj/argo-cd/v2/acr_controller/application"
"github.com/argoproj/argo-cd/v2/acr_controller/service"

Check failure on line 8 in acr_controller/controller/controller.go

View workflow job for this annotation

GitHub Actions / Lint Go code

could not import github.com/argoproj/argo-cd/v2/acr_controller/service (-: # github.com/argoproj/argo-cd/v2/acr_controller/service
appclientset "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned"
"time"

appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
applisters "github.com/argoproj/argo-cd/v2/pkg/client/listers/application/v1alpha1"
servercache "github.com/argoproj/argo-cd/v2/server/cache"
"github.com/argoproj/argo-cd/v2/util/settings"
log "github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)

var (
watchAPIBufferSize = 1000
)
var watchAPIBufferSize = 1000

type ACRController interface {
Run(ctx context.Context)
Expand Down Expand Up @@ -52,9 +48,7 @@ func NewApplicationChangeRevisionController(appInformer cache.SharedIndexInforme
}

func (c *applicationChangeRevisionController) Run(ctx context.Context) {
var (
logCtx log.FieldLogger = log.StandardLogger()
)
var logCtx log.FieldLogger = log.StandardLogger()

calculateIfPermitted := func(ctx context.Context, a appv1.Application, eventType watch.EventType, ts string) error {
if eventType == watch.Bookmark || eventType == watch.Deleted {
Expand All @@ -64,7 +58,7 @@ func (c *applicationChangeRevisionController) Run(ctx context.Context) {
return c.acrService.ChangeRevision(ctx, &a)
}

//TODO: move to abstraction
// TODO: move to abstraction
eventsChannel := make(chan *appv1.ApplicationWatchEvent, watchAPIBufferSize)
unsubscribe := c.appBroadcaster.Subscribe(eventsChannel)
defer unsubscribe()
Expand Down
20 changes: 11 additions & 9 deletions acr_controller/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@ import (
"context"
"crypto/tls"
"fmt"
appclient "github.com/argoproj/argo-cd/v2/acr_controller/application"
acr_controller "github.com/argoproj/argo-cd/v2/acr_controller/controller"
"github.com/argoproj/argo-cd/v2/event_reporter/reporter"
"net"
"net/http"
"strings"
"time"

appclient "github.com/argoproj/argo-cd/v2/acr_controller/application"
acr_controller "github.com/argoproj/argo-cd/v2/acr_controller/controller"
"github.com/argoproj/argo-cd/v2/event_reporter/reporter"

"github.com/redis/go-redis/v9"
log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"

appclientset "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned"
appinformer "github.com/argoproj/argo-cd/v2/pkg/client/informers/externalversions"
applisters "github.com/argoproj/argo-cd/v2/pkg/client/listers/application/v1alpha1"
Expand All @@ -20,12 +28,6 @@ import (
errorsutil "github.com/argoproj/argo-cd/v2/util/errors"
"github.com/argoproj/argo-cd/v2/util/healthz"
settings_util "github.com/argoproj/argo-cd/v2/util/settings"
"github.com/redis/go-redis/v9"
log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
)

const (
Expand Down
9 changes: 4 additions & 5 deletions acr_controller/service/acr_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package service
import (
"context"
"encoding/json"
argoclient "github.com/argoproj/argo-cd/v2/acr_controller/application"
appclient "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
application "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned"
"sync"

Check failure on line 6 in acr_controller/service/acr_service.go

View workflow job for this annotation

GitHub Actions / Build & cache Go code

other declaration of sync

Check failure on line 6 in acr_controller/service/acr_service.go

View workflow job for this annotation

GitHub Actions / Lint Go code

other declaration of sync

"sync"

Check failure on line 8 in acr_controller/service/acr_service.go

View workflow job for this annotation

GitHub Actions / Build & cache Go code

sync redeclared in this block

Check failure on line 8 in acr_controller/service/acr_service.go

View workflow job for this annotation

GitHub Actions / Lint Go code

sync redeclared in this block

log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"sync"
)

type ACRService interface {
Expand Down
10 changes: 4 additions & 6 deletions acr_controller/service/acr_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ package service

import (
"context"
"github.com/argoproj/argo-cd/v2/acr_controller/application/mocks"
appclient "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
appsv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
apps "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned/fake"
"github.com/argoproj/argo-cd/v2/test"
"testing"

"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"sigs.k8s.io/yaml"
"testing"
)

const fakeApp = `
Expand Down
5 changes: 4 additions & 1 deletion server/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/argoproj/argo-cd/v2/util/app/path"
"math"
"reflect"
"sort"
"strconv"
"strings"
"time"

"github.com/argoproj/argo-cd/v2/util/app/path"

"github.com/argoproj/argo-cd/v2/util/app/path"

kubecache "github.com/argoproj/gitops-engine/pkg/cache"
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/argoproj/gitops-engine/pkg/sync/common"
Expand Down

0 comments on commit f5a1f50

Please sign in to comment.