Skip to content

Commit

Permalink
clean go package import
Browse files Browse the repository at this point in the history
Signed-off-by: chentanjun <[email protected]>
  • Loading branch information
tanjunchen committed Aug 3, 2023
1 parent 2429a9e commit f012c87
Show file tree
Hide file tree
Showing 38 changed files with 95 additions and 156 deletions.
3 changes: 1 addition & 2 deletions cmd/aeraki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"syscall"

"github.com/google/uuid"
"istio.io/pkg/log"

"github.com/aeraki-mesh/aeraki/internal/bootstrap"
"github.com/aeraki-mesh/aeraki/internal/config/constants"
Expand All @@ -31,8 +32,6 @@ import (
"github.com/aeraki-mesh/aeraki/internal/plugin/metaprotocol"
"github.com/aeraki-mesh/aeraki/internal/plugin/thrift"
"github.com/aeraki-mesh/aeraki/internal/plugin/zookeeper"

"istio.io/pkg/log"
)

const (
Expand Down
7 changes: 2 additions & 5 deletions internal/bootstrap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ import (
"sync"
"sync/atomic"
"time"

//nolint: gosec
_ "net/http/pprof" // pprof

"istio.io/istio/pkg/config/mesh"

istioscheme "istio.io/client-go/pkg/apis/networking/v1alpha3"
"istio.io/client-go/pkg/clientset/versioned"
"istio.io/istio/pilot/pkg/model"
istioconfig "istio.io/istio/pkg/config"
"istio.io/istio/pkg/config/mesh"
kubelib "istio.io/istio/pkg/kube"
"istio.io/pkg/log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -44,8 +42,6 @@ import (
kubeconfig "sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/manager"

aerakischeme "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/scheme"

"github.com/aeraki-mesh/aeraki/internal/controller/istio"
"github.com/aeraki-mesh/aeraki/internal/controller/kube"
"github.com/aeraki-mesh/aeraki/internal/envoyfilter"
Expand All @@ -55,6 +51,7 @@ import (
"github.com/aeraki-mesh/aeraki/internal/plugin/redis"
"github.com/aeraki-mesh/aeraki/internal/util"
"github.com/aeraki-mesh/aeraki/internal/xds"
aerakischeme "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/scheme"
)

var (
Expand Down
8 changes: 3 additions & 5 deletions internal/ca/istio_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ import (
"path"
"time"

"istio.io/istio/security/pkg/pki/util"

"istio.io/istio/pilot/pkg/bootstrap"
"istio.io/istio/security/pkg/cmd"
"istio.io/pkg/env"

"istio.io/istio/pkg/security"
"istio.io/istio/security/pkg/cmd"
"istio.io/istio/security/pkg/pki/ca"
"istio.io/istio/security/pkg/pki/ra"
"istio.io/istio/security/pkg/pki/util"
"istio.io/pkg/env"
"istio.io/pkg/log"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
)
Expand Down
17 changes: 7 additions & 10 deletions internal/controller/istio/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ import (
"strings"
"time"

"github.com/aeraki-mesh/aeraki/internal/model"

"istio.io/istio/pkg/security"

"istio.io/istio/security/pkg/nodeagent/cache"

discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
networking "istio.io/api/networking/v1alpha3"
"istio.io/istio/pilot/pkg/config/memory"
Expand All @@ -33,9 +27,12 @@ import (
istioconfig "istio.io/istio/pkg/config"
"istio.io/istio/pkg/config/schema/collection"
"istio.io/istio/pkg/config/schema/collections"
"istio.io/istio/pkg/security"
"istio.io/istio/security/pkg/nodeagent/cache"
citadel "istio.io/istio/security/pkg/nodeagent/caclient/providers/citadel"
"istio.io/pkg/log"

"github.com/aeraki-mesh/aeraki/internal/model"
"github.com/aeraki-mesh/aeraki/internal/model/protocol"
)

Expand All @@ -51,10 +48,10 @@ var (
controllerLog = log.RegisterScope("config-controller", "config-controller debugging", 0)
// We need serviceentry and virtualservice to generate the envoyfiters
configCollection = collection.NewSchemasBuilder().MustAdd(collections.IstioNetworkingV1Alpha3Serviceentries).
MustAdd(collections.IstioNetworkingV1Alpha3Virtualservices).
MustAdd(collections.IstioNetworkingV1Alpha3Destinationrules).
MustAdd(collections.IstioNetworkingV1Alpha3Envoyfilters).
MustAdd(collections.IstioNetworkingV1Alpha3Gateways).Build()
MustAdd(collections.IstioNetworkingV1Alpha3Virtualservices).

Check failure on line 51 in internal/controller/istio/controller.go

View workflow job for this annotation

GitHub Actions / go-lint

File is not `gofmt`-ed with `-s` (gofmt)
MustAdd(collections.IstioNetworkingV1Alpha3Destinationrules).
MustAdd(collections.IstioNetworkingV1Alpha3Envoyfilters).
MustAdd(collections.IstioNetworkingV1Alpha3Gateways).Build()
)

// Options for config controller
Expand Down
6 changes: 2 additions & 4 deletions internal/controller/kube/metaprotocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ package kube
import (
"context"

"sigs.k8s.io/controller-runtime/pkg/client"

metaprotocolmodel "github.com/aeraki-mesh/aeraki/internal/model/metaprotocol"

"istio.io/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/handler"
Expand All @@ -30,6 +27,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

metaprotocolmodel "github.com/aeraki-mesh/aeraki/internal/model/metaprotocol"
"github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1"
)

Expand Down
3 changes: 1 addition & 2 deletions internal/controller/kube/metarouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ package kube
import (
"context"

"sigs.k8s.io/controller-runtime/pkg/client"

"istio.io/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/handler"
Expand Down
7 changes: 3 additions & 4 deletions internal/controller/kube/namesapce.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ import (
"context"
"fmt"

"k8s.io/apimachinery/pkg/api/errors"

"github.com/aeraki-mesh/aeraki/internal/config/constants"

"istio.io/pkg/log"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
controllerclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/event"
Expand All @@ -32,6 +29,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

"github.com/aeraki-mesh/aeraki/internal/config/constants"
)

var namespaceLog = log.RegisterScope("namespace-controller", "namespace-controller debugging", 0)
Expand Down
9 changes: 4 additions & 5 deletions internal/controller/kube/serviceentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ import (
"reflect"
"strings"

"k8s.io/apimachinery/pkg/api/errors"

"github.com/aeraki-mesh/aeraki/internal/config/constants"
"github.com/aeraki-mesh/aeraki/internal/model"

istionapi "istio.io/api/networking/v1alpha3"
networking "istio.io/client-go/pkg/apis/networking/v1alpha3"
"istio.io/pkg/log"
"k8s.io/apimachinery/pkg/api/errors"
controllerclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/event"
Expand All @@ -36,6 +32,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

"github.com/aeraki-mesh/aeraki/internal/config/constants"
"github.com/aeraki-mesh/aeraki/internal/model"
)

var serviceEntryLog = log.RegisterScope("service-entry-controller", "service-entry-controller debugging", 0)
Expand Down
10 changes: 4 additions & 6 deletions internal/envoyfilter/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,24 @@ import (
"strings"
"time"

istioclient "istio.io/client-go/pkg/clientset/versioned"
"istio.io/istio/pkg/config"

"github.com/zhaohuabing/debounce"
"google.golang.org/protobuf/proto"
networking "istio.io/api/networking/v1alpha3"
"istio.io/client-go/pkg/apis/networking/v1alpha3"
istioclient "istio.io/client-go/pkg/clientset/versioned"
istiomodel "istio.io/istio/pilot/pkg/model"
"istio.io/istio/pkg/config"
"istio.io/istio/pkg/config/mesh"
"istio.io/istio/pkg/config/schema/collections"
"istio.io/pkg/log"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

Check failure on line 35 in internal/envoyfilter/controller.go

View workflow job for this annotation

GitHub Actions / go-lint

File is not `goimports`-ed with -local github.com/aeraki-mesh/aeraki (goimports)
"github.com/aeraki-mesh/api/metaprotocol/v1alpha1"
metaprotocol "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1"

"github.com/aeraki-mesh/aeraki/internal/config/constants"
"github.com/aeraki-mesh/aeraki/internal/model"
"github.com/aeraki-mesh/aeraki/internal/model/protocol"
"github.com/aeraki-mesh/api/metaprotocol/v1alpha1"
metaprotocol "github.com/aeraki-mesh/client-go/pkg/apis/metaprotocol/v1alpha1"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions internal/envoyfilter/network_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import (
"strconv"
"strings"

_struct "github.com/golang/protobuf/ptypes/struct"

"github.com/envoyproxy/go-control-plane/pkg/wellknown"
_struct "github.com/golang/protobuf/ptypes/struct"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
networking "istio.io/api/networking/v1alpha3"
Expand Down
3 changes: 1 addition & 2 deletions internal/envoyfilter/network_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import (
"reflect"
"testing"

istioconfig "istio.io/istio/pkg/config"

networking "istio.io/api/networking/v1alpha3"
istioconfig "istio.io/istio/pkg/config"

"github.com/aeraki-mesh/aeraki/internal/model"
)
Expand Down
3 changes: 1 addition & 2 deletions internal/leaderelection/leaderelection.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import (
"context"
"time"

"go.uber.org/atomic"
"istio.io/istio/pilot/pkg/leaderelection/k8sleaderelection"
"istio.io/istio/pilot/pkg/leaderelection/k8sleaderelection/k8sresourcelock"

"go.uber.org/atomic"
"istio.io/pkg/log"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand Down
3 changes: 1 addition & 2 deletions internal/leaderelection/leaderelection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ import (
"time"

"go.uber.org/atomic"
"istio.io/istio/pkg/test/util/retry"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/fake"
k8stesting "k8s.io/client-go/testing"

"istio.io/istio/pkg/test/util/retry"
)

const testLock = "test-lock"
Expand Down
1 change: 0 additions & 1 deletion internal/model/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"strings"

networking "istio.io/api/networking/v1alpha3"

istiomodel "istio.io/istio/pilot/pkg/model"
"istio.io/istio/pkg/config/host"
)
Expand Down
13 changes: 5 additions & 8 deletions internal/plugin/dubbo/authz/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@ import (
"context"
"fmt"

"google.golang.org/protobuf/types/known/anypb"

v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

dubborulepb "github.com/aeraki-mesh/api/dubbo/v1alpha1"
dubboapi "github.com/aeraki-mesh/client-go/pkg/apis/dubbo/v1alpha1"
dubboclient "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1"

rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3"
dubbopb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/dubbo_proxy/v3"
rbacdubbopb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/rbac/v3"
"google.golang.org/protobuf/types/known/anypb"
"istio.io/istio/pilot/pkg/security/trustdomain"
"istio.io/pkg/log"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

authzmodel "github.com/aeraki-mesh/aeraki/internal/plugin/dubbo/authz/model"

Check failure on line 29 in internal/plugin/dubbo/authz/builder/builder.go

View workflow job for this annotation

GitHub Actions / go-lint

File is not `goimports`-ed with -local github.com/aeraki-mesh/aeraki (goimports)
dubborulepb "github.com/aeraki-mesh/api/dubbo/v1alpha1"
dubboapi "github.com/aeraki-mesh/client-go/pkg/apis/dubbo/v1alpha1"
dubboclient "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1"
)

var (
Expand Down
1 change: 0 additions & 1 deletion internal/plugin/dubbo/authz/model/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"strings"

rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3"

"istio.io/istio/pkg/spiffe"

"github.com/aeraki-mesh/aeraki/internal/plugin/dubbo/authz/matcher"
Expand Down
3 changes: 1 addition & 2 deletions internal/plugin/dubbo/authz/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import (
"fmt"

rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3"
"istio.io/istio/pilot/pkg/security/trustdomain"

dubbopb "github.com/aeraki-mesh/api/dubbo/v1alpha1"

"istio.io/istio/pilot/pkg/security/trustdomain"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions internal/plugin/dubbo/dubboproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ import (
"istio.io/istio/pilot/pkg/security/trustdomain"
"istio.io/istio/pkg/spiffe"

dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1"

"github.com/aeraki-mesh/aeraki/internal/model"
"github.com/aeraki-mesh/aeraki/internal/plugin/dubbo/authz/builder"
dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1"
)

func buildOutboundProxy(context *model.EnvoyFilterContext) *dubbo.DubboProxy {
Expand Down
8 changes: 3 additions & 5 deletions internal/plugin/dubbo/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
package dubbo

import (
"k8s.io/client-go/rest"

"github.com/aeraki-mesh/client-go/pkg/clientset/versioned"
dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1"

"istio.io/pkg/log"
"k8s.io/client-go/rest"

"github.com/aeraki-mesh/aeraki/internal/envoyfilter"
"github.com/aeraki-mesh/aeraki/internal/model"
"github.com/aeraki-mesh/client-go/pkg/clientset/versioned"
dubbov1alpha1 "github.com/aeraki-mesh/client-go/pkg/clientset/versioned/typed/dubbo/v1alpha1"
)

var generatorLog = log.RegisterScope("dubbo-generator", "dubbo generator", 0)
Expand Down
11 changes: 5 additions & 6 deletions internal/plugin/metaprotocol/accesslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
package metaprotocol

import (
"google.golang.org/protobuf/types/known/structpb"
"istio.io/istio/pkg/util/protomarshal"
"istio.io/pkg/log"

"github.com/aeraki-mesh/aeraki/internal/util/protoconv"

accesslog "github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3"
envoyconfig "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
fileaccesslog "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3"
"github.com/envoyproxy/go-control-plane/pkg/wellknown"
"google.golang.org/protobuf/types/known/structpb"
meshconfig "istio.io/api/mesh/v1alpha1"
"istio.io/istio/pkg/util/protomarshal"
"istio.io/pkg/log"

"github.com/aeraki-mesh/aeraki/internal/util/protoconv"
)

const (
Expand Down
Loading

0 comments on commit f012c87

Please sign in to comment.