Skip to content

Commit

Permalink
format code about goimports and gci
Browse files Browse the repository at this point in the history
Signed-off-by: chaosi-zju <[email protected]>
  • Loading branch information
chaosi-zju committed Jan 22, 2025
1 parent c08f8a0 commit 5581849
Show file tree
Hide file tree
Showing 112 changed files with 462 additions and 295 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
go-version-file: go.mod
- name: verify license
run: hack/verify-license.sh
- name: lint
run: hack/verify-staticcheck.sh
build-frontend:
runs-on: ubuntu-22.04
steps:
Expand Down
54 changes: 27 additions & 27 deletions cmd/api/app/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@ package app
import (
"context"
"fmt"
"github.com/karmada-io/dashboard/cmd/api/app/options"
"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/config"
"github.com/karmada-io/dashboard/pkg/environment"
"os"

"github.com/karmada-io/karmada/pkg/sharedcli/klogflag"
"github.com/spf13/cobra"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/klog/v2"
"os"

// Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/auth"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/cluster"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/clusteroverridepolicy"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/clusterpropagationpolicy"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/config"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/configmap"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/cronjob"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/daemonset"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/deployment"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/ingress"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/job"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/member"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/namespace"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/overridepolicy"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/overview"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/propagationpolicy"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/secret"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/service"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/statefulset"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/unstructured"
"github.com/karmada-io/dashboard/cmd/api/app/options"
"github.com/karmada-io/dashboard/cmd/api/app/router"
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/auth" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/cluster" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/clusteroverridepolicy" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/clusterpropagationpolicy" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/config" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/configmap" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/cronjob" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/daemonset" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/deployment" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/ingress" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/job" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/member" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/namespace" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/overridepolicy" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/overview" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/propagationpolicy" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/secret" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/service" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/statefulset" // Importing route packages forces route registration
_ "github.com/karmada-io/dashboard/cmd/api/app/routes/unstructured" // Importing route packages forces route registration
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/config"
"github.com/karmada-io/dashboard/pkg/environment"
)

// NewApiCommand creates a *cobra.Command object with default parameters
Expand Down
3 changes: 2 additions & 1 deletion cmd/api/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package options

import (
"github.com/spf13/pflag"
"net"

"github.com/spf13/pflag"
)

// Options contains everything necessary to create and run api.
Expand Down
6 changes: 4 additions & 2 deletions cmd/api/app/router/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ package router

import (
"context"
"net/http"

"github.com/gin-gonic/gin"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"net/http"
)

func EnsureMemberClusterMiddleware() gin.HandlerFunc {
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/router/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package router

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/pkg/environment"
)

Expand Down
3 changes: 2 additions & 1 deletion cmd/api/app/routes/auth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package auth

import (
"github.com/gin-gonic/gin"
"k8s.io/klog/v2"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"k8s.io/klog/v2"
)

func handleLogin(c *gin.Context) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/api/app/routes/auth/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ limitations under the License.
package auth

import (
"net/http"

v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/common/errors"
"net/http"
)

func login(spec *v1.LoginRequest, request *http.Request) (*v1.LoginResponse, int, error) {
Expand Down
4 changes: 3 additions & 1 deletion cmd/api/app/routes/auth/me.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ package auth
import (
"bytes"
"encoding/json"
"net/http"

"github.com/golang-jwt/jwt/v5"

v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/common/errors"
"net/http"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion cmd/api/app/routes/cluster/accesscluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package cluster
import (
"context"
"fmt"
"time"

clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
karmadaclientset "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
cmdutil "github.com/karmada-io/karmada/pkg/karmadactl/util"
Expand All @@ -32,7 +34,6 @@ import (
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"k8s.io/klog/v2"
"time"
)

const (
Expand Down
14 changes: 8 additions & 6 deletions cmd/api/app/routes/cluster/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ package cluster
import (
"context"
"fmt"
"time"

"github.com/gin-gonic/gin"
"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/resource/cluster"
"github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog/v2"
"time"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/resource/cluster"
)

func handleGetClusterList(c *gin.Context) {
Expand Down
12 changes: 7 additions & 5 deletions cmd/api/app/routes/clusteroverridepolicy/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ package propagationpolicy

import (
"context"

"github.com/gin-gonic/gin"
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/common/errors"
"github.com/karmada-io/dashboard/pkg/resource/clusteroverridepolicy"
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"
)

func handleGetClusterOverridePolicyList(c *gin.Context) {
Expand Down
12 changes: 7 additions & 5 deletions cmd/api/app/routes/clusterpropagationpolicy/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ package propagationpolicy

import (
"context"

"github.com/gin-gonic/gin"
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/common/errors"
"github.com/karmada-io/dashboard/pkg/resource/clusterpropagationpolicy"
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"
)

func handleGetClusterPropagationPolicyList(c *gin.Context) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/api/app/routes/config/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ package config

import (
"github.com/gin-gonic/gin"
"k8s.io/klog/v2"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/config"
"k8s.io/klog/v2"
)

func GetDashboardConfig(c *gin.Context) {
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/configmap/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package service

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/cronjob/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployment

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/daemonset/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployment

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
10 changes: 6 additions & 4 deletions cmd/api/app/routes/deployment/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ package deployment

import (
"context"

"github.com/gin-gonic/gin"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/yaml"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/resource/deployment"
"github.com/karmada-io/dashboard/pkg/resource/event"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/yaml"
)

func handlerCreateDeployment(c *gin.Context) {
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/ingress/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package ingress

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/job/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployment

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/member/deployment/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployment

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/member/namespace/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package namespace

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/member/node/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package node

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/member/pod/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package pod

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
Expand Down
1 change: 1 addition & 0 deletions cmd/api/app/routes/namespace/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package namespace

import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
Expand Down
12 changes: 7 additions & 5 deletions cmd/api/app/routes/overridepolicy/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ package overridepolicy

import (
"context"

"github.com/gin-gonic/gin"
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"

"github.com/karmada-io/dashboard/cmd/api/app/router"
v1 "github.com/karmada-io/dashboard/cmd/api/app/types/api/v1"
"github.com/karmada-io/dashboard/cmd/api/app/types/common"
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/common/errors"
"github.com/karmada-io/dashboard/pkg/resource/overridepolicy"
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"
)

func handleGetOverridePolicyList(c *gin.Context) {
Expand Down
Loading

0 comments on commit 5581849

Please sign in to comment.