Skip to content

Commit

Permalink
Merge pull request etcd-io#16628 from fuweid/fix-goimports
Browse files Browse the repository at this point in the history
*: fix goimports linter
  • Loading branch information
ahrtr committed Sep 22, 2023
2 parents 3eae42d + 46df6ab commit e1ebc26
Show file tree
Hide file tree
Showing 175 changed files with 410 additions and 500 deletions.
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ fuzz:

verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword \
verify-govet verify-license-header verify-receiver-name verify-mod-tidy verify-shellcheck \
verify-shellws verify-proto-annotations verify-genproto verify-goimport verify-yamllint \
verify-shellws verify-proto-annotations verify-genproto verify-yamllint \
verify-govet-shadow
fix: fix-goimports fix-bom fix-lint fix-yamllint
fix: fix-bom fix-lint fix-yamllint
./scripts/fix.sh

.PHONY: verify-gofmt
Expand All @@ -91,7 +91,7 @@ verify-lint:

.PHONY: fix-lint
fix-lint:
golangci-lint run --config tools/.golangci.yaml --fix
PASSES="lint_fix" ./scripts/test.sh

.PHONY: verify-shellcheck
verify-shellcheck:
Expand Down Expand Up @@ -129,14 +129,6 @@ verify-proto-annotations:
verify-genproto:
PASSES="genproto" ./scripts/test.sh

.PHONY: verify-goimport
verify-goimport:
PASSES="goimport" ./scripts/test.sh

.PHONY: fix-goimports
fix-goimports:
./scripts/fix-goimports.sh

.PHONY: verify-yamllint
verify-yamllint:
yamllint --config-file tools/.yamllint .
Expand Down
4 changes: 2 additions & 2 deletions client/pkg/logutil/zap_journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
"os"
"path/filepath"

"go.etcd.io/etcd/client/pkg/v3/systemd"

"github.com/coreos/go-systemd/v22/journal"
"go.uber.org/zap/zapcore"

"go.etcd.io/etcd/client/pkg/v3/systemd"
)

// NewJournalWriter wraps "io.Writer" to redirect log output
Expand Down
4 changes: 2 additions & 2 deletions client/pkg/transport/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import (
"strings"
"time"

"go.uber.org/zap"

"go.etcd.io/etcd/client/pkg/v3/fileutil"
"go.etcd.io/etcd/client/pkg/v3/tlsutil"
"go.etcd.io/etcd/client/pkg/v3/verify"

"go.uber.org/zap"
)

// NewListener creates a new listner.
Expand Down
4 changes: 1 addition & 3 deletions client/v3/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ import (
"github.com/coreos/go-semver/semver"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.uber.org/zap"
"go.uber.org/zap/zaptest"
"google.golang.org/grpc"

"go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
"go.etcd.io/etcd/api/v3/version"
"go.etcd.io/etcd/client/pkg/v3/testutil"

"google.golang.org/grpc"
)

func NewClient(t *testing.T, cfg Config) (*Client, error) {
Expand Down
4 changes: 2 additions & 2 deletions client/v3/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ package clientv3
import (
"context"

"google.golang.org/grpc"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/client/pkg/v3/types"

"google.golang.org/grpc"
)

type (
Expand Down
6 changes: 3 additions & 3 deletions client/v3/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (
"sync"
"time"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"

"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
)

type (
Expand Down
6 changes: 3 additions & 3 deletions client/v3/leasing/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (
"sync"
"time"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/mvccpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
v3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/concurrency"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

type leasingKV struct {
Expand Down
4 changes: 2 additions & 2 deletions client/v3/mock/mockserver/mockserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"os"
"sync"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"

"google.golang.org/grpc"
"google.golang.org/grpc/resolver"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
)

// MockServer provides a mocked out grpc server of the etcdserver interface.
Expand Down
6 changes: 3 additions & 3 deletions client/v3/naming/endpoints/endpoints_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"errors"
"strings"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/naming/endpoints/internal"

"go.uber.org/zap"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/naming/endpoints/internal"
)

type endpointManager struct {
Expand Down
6 changes: 3 additions & 3 deletions client/v3/naming/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (
"strings"
"sync"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/naming/endpoints"

"google.golang.org/grpc/codes"
gresolver "google.golang.org/grpc/resolver"
"google.golang.org/grpc/status"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/naming/endpoints"
)

type builder struct {
Expand Down
6 changes: 3 additions & 3 deletions client/v3/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package clientv3
import (
"context"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"

"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
)

type retryPolicy uint8
Expand Down
4 changes: 2 additions & 2 deletions client/v3/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"context"
"sync"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"

"google.golang.org/grpc"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
)

// Txn is the interface that wraps mini-transactions.
Expand Down
8 changes: 4 additions & 4 deletions etcdctl/ctlv3/command/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import (
"sync"
"time"

v3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"
"go.etcd.io/etcd/pkg/v3/report"

"github.com/cheggaaa/pb/v3"
"github.com/spf13/cobra"
"golang.org/x/time/rate"

v3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"
"go.etcd.io/etcd/pkg/v3/report"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/elect_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"os/signal"
"syscall"

"github.com/spf13/cobra"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/concurrency"
"go.etcd.io/etcd/pkg/v3/cobrautl"

"github.com/spf13/cobra"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions etcdctl/ctlv3/command/ep_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (
"sync"
"time"

"github.com/spf13/cobra"
"go.uber.org/zap"

"go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
"go.etcd.io/etcd/client/pkg/v3/logutil"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"
"go.etcd.io/etcd/pkg/v3/flags"

"github.com/spf13/cobra"
"go.uber.org/zap"
)

var epClusterEndpoints bool
Expand Down
9 changes: 4 additions & 5 deletions etcdctl/ctlv3/command/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@ import (
"time"

"github.com/bgentry/speakeasy"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"go.uber.org/zap"
"google.golang.org/grpc/grpclog"

"go.etcd.io/etcd/client/pkg/v3/logutil"
"go.etcd.io/etcd/client/pkg/v3/srv"
"go.etcd.io/etcd/client/pkg/v3/transport"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"
"go.etcd.io/etcd/pkg/v3/flags"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"go.uber.org/zap"
"google.golang.org/grpc/grpclog"
)

// GlobalFlags are flags that defined globally
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/lease_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"fmt"
"strconv"

"github.com/spf13/cobra"

v3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"

"github.com/spf13/cobra"
)

// NewLeaseCommand returns the cobra command for "lease".
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/lock_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import (
"os/signal"
"syscall"

"github.com/spf13/cobra"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/concurrency"
"go.etcd.io/etcd/pkg/v3/cobrautl"

"github.com/spf13/cobra"
)

var lockTTL = 10
Expand Down
6 changes: 2 additions & 4 deletions etcdctl/ctlv3/command/make_mirror_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ import (
"time"

"github.com/bgentry/speakeasy"

"go.etcd.io/etcd/pkg/v3/cobrautl"
"github.com/spf13/cobra"

"go.etcd.io/etcd/api/v3/mvccpb"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/mirror"

"github.com/spf13/cobra"
"go.etcd.io/etcd/pkg/v3/cobrautl"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
"fmt"
"strings"

"github.com/dustin/go-humanize"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
v3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"

"github.com/dustin/go-humanize"
)

type printer interface {
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/printer_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package command
import (
"os"

v3 "go.etcd.io/etcd/client/v3"

"github.com/olekukonko/tablewriter"

v3 "go.etcd.io/etcd/client/v3"
)

type tablePrinter struct{ printer }
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/txn_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"strconv"
"strings"

"github.com/spf13/cobra"

pb "go.etcd.io/etcd/api/v3/etcdserverpb"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"

"github.com/spf13/cobra"
)

var txnInteractive bool
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (
"strings"
"time"

"github.com/spf13/cobra"

pb "go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"

"github.com/spf13/cobra"
)

func printKV(isHex bool, valueOnly bool, kv *pb.KeyValue) {
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/version_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package command
import (
"fmt"

"go.etcd.io/etcd/api/v3/version"

"github.com/spf13/cobra"

"go.etcd.io/etcd/api/v3/version"
)

// NewVersionCommand prints out the version of etcd.
Expand Down
4 changes: 2 additions & 2 deletions etcdctl/ctlv3/command/watch_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"os/exec"
"strings"

"github.com/spf13/cobra"

clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/pkg/v3/cobrautl"

"github.com/spf13/cobra"
)

var (
Expand Down
Loading

0 comments on commit e1ebc26

Please sign in to comment.