Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: add gci to format imports #7346

Merged
merged 2 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
go: 1.19
go: "1.19"
linters:
enable:
- unconvert
Expand All @@ -14,7 +14,6 @@ linters:
- structcheck
- deadcode
- gosimple
- goimports
- errcheck
- staticcheck
- stylecheck
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ clean_integration_test_containers: ## Clean MySQL and Kafka integration test con
docker-compose -f $(TICDC_DOCKER_DEPLOYMENTS_DIR)/docker-compose-mysql-integration.yml down -v
docker-compose -f $(TICDC_DOCKER_DEPLOYMENTS_DIR)/docker-compose-kafka-integration.yml down -v

fmt: tools/bin/gofumports tools/bin/shfmt generate_mock generate-msgp-code tiflow-generate-mock
@echo "gofmt (simplify)"
fmt: tools/bin/gofumports tools/bin/shfmt tools/bin/gci generate_mock generate-msgp-code tiflow-generate-mock
@echo "run gci (format imports)"
tools/bin/gci write $(FILES) 2>&1 | $(FAIL_ON_STDOUT)
@echo "run gofumports"
tools/bin/gofumports -l -w $(FILES) 2>&1 | $(FAIL_ON_STDOUT)
@echo "run shfmt"
tools/bin/shfmt -d -w .
Expand Down
7 changes: 3 additions & 4 deletions cdc/api/owner/owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ import (
"github.com/pingcap/log"
"github.com/pingcap/tiflow/cdc/api"
"github.com/pingcap/tiflow/cdc/api/middleware"
"github.com/tikv/client-go/v2/oracle"
"go.etcd.io/etcd/client/v3/concurrency"
"go.uber.org/zap"

"github.com/pingcap/tiflow/cdc/capture"
"github.com/pingcap/tiflow/cdc/model"
cerror "github.com/pingcap/tiflow/pkg/errors"
"github.com/pingcap/tiflow/pkg/logutil"
"github.com/tikv/client-go/v2/oracle"
"go.etcd.io/etcd/client/v3/concurrency"
"go.uber.org/zap"
)

const (
Expand Down
7 changes: 3 additions & 4 deletions cdc/entry/schema/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tidb/ddl"
timeta "github.com/pingcap/tidb/meta"
"github.com/pingcap/tidb/parser"
"github.com/pingcap/tidb/parser/ast"
timodel "github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tidb/parser/mysql"
"github.com/pingcap/tidb/session"
"github.com/pingcap/tiflow/cdc/model"
"go.uber.org/zap"

timeta "github.com/pingcap/tidb/meta"
timodel "github.com/pingcap/tidb/parser/model"
cerror "github.com/pingcap/tiflow/pkg/errors"
"go.uber.org/zap"
)

// Snapshot stores the source TiDB all schema information.
Expand Down
5 changes: 2 additions & 3 deletions cdc/entry/schema_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ import (
"github.com/pingcap/tidb/store/mockstore"
"github.com/pingcap/tidb/testkit"
"github.com/pingcap/tidb/types"
"github.com/stretchr/testify/require"
"github.com/tikv/client-go/v2/oracle"

"github.com/pingcap/tiflow/cdc/entry/schema"
"github.com/pingcap/tiflow/cdc/kv"
"github.com/pingcap/tiflow/cdc/model"
"github.com/stretchr/testify/require"
"github.com/tikv/client-go/v2/oracle"
)

func TestSchema(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions cdc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ import (
v1 "github.com/pingcap/tiflow/cdc/api/v1"
v2 "github.com/pingcap/tiflow/cdc/api/v2"
"github.com/pingcap/tiflow/cdc/capture"
_ "github.com/pingcap/tiflow/docs/swagger" // use for OpenAPI online docs
"github.com/pingcap/tiflow/pkg/util"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"

// use for OpenAPI online docs
_ "github.com/pingcap/tiflow/docs/swagger"
)

// RegisterRoutes create a router for OpenAPI
Expand Down
3 changes: 1 addition & 2 deletions cdc/owner/status_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ package owner
import (
"context"

cerror "github.com/pingcap/tiflow/pkg/errors"

"github.com/pingcap/errors"
"github.com/pingcap/tiflow/cdc/model"
cerror "github.com/pingcap/tiflow/pkg/errors"
)

// StatusProvider provide some func to get meta-information from owner
Expand Down
3 changes: 1 addition & 2 deletions cdc/processor/pipeline/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"sync/atomic"
"time"

"golang.org/x/time/rate"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/log"
Expand All @@ -32,6 +30,7 @@ import (
cerror "github.com/pingcap/tiflow/pkg/errors"
pmessage "github.com/pingcap/tiflow/pkg/pipeline/message"
"go.uber.org/zap"
"golang.org/x/time/rate"
)

const (
Expand Down
5 changes: 2 additions & 3 deletions cdc/processor/pipeline/table_actor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/pingcap/tiflow/pkg/actor"
"github.com/pingcap/tiflow/pkg/actor/message"
"github.com/pingcap/tiflow/pkg/config"
serverConfig "github.com/pingcap/tiflow/pkg/config"
cdcContext "github.com/pingcap/tiflow/pkg/context"
pmessage "github.com/pingcap/tiflow/pkg/pipeline/message"
"github.com/pingcap/tiflow/pkg/upstream"
Expand Down Expand Up @@ -76,8 +75,8 @@ func TestTableActorInterface(t *testing.T) {
redoManager: redo.NewDisabledManager(),
tableName: "t1",
state: tablepb.TableStatePreparing,
replicaConfig: &serverConfig.ReplicaConfig{
Consistent: &serverConfig.ConsistentConfig{
replicaConfig: &config.ReplicaConfig{
Consistent: &config.ConsistentConfig{
Level: "node",
},
},
Expand Down
3 changes: 1 addition & 2 deletions cdc/redo/common/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import (
"fmt"
"testing"

"github.com/pingcap/tiflow/cdc/model"

"github.com/google/uuid"
"github.com/pingcap/tiflow/cdc/model"
"github.com/stretchr/testify/require"
)

Expand Down
11 changes: 5 additions & 6 deletions cdc/redo/writer/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/prometheus/client_golang/prometheus"
"github.com/uber-go/atomic"
pioutil "go.etcd.io/etcd/pkg/v3/ioutil"
"go.uber.org/multierr"
"go.uber.org/zap"

"github.com/pingcap/tiflow/cdc/model"
"github.com/pingcap/tiflow/cdc/redo/common"
cerror "github.com/pingcap/tiflow/pkg/errors"
"github.com/pingcap/tiflow/pkg/fsutil"
"github.com/pingcap/tiflow/pkg/uuid"
"github.com/prometheus/client_golang/prometheus"
"github.com/uber-go/atomic"
pioutil "go.etcd.io/etcd/pkg/v3/ioutil"
"go.uber.org/multierr"
"go.uber.org/zap"
)

const (
Expand Down
5 changes: 2 additions & 3 deletions cdc/redo/writer/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ import (
backuppb "github.com/pingcap/kvproto/pkg/brpb"
mockstorage "github.com/pingcap/tidb/br/pkg/mock/storage"
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/stretchr/testify/require"
"github.com/uber-go/atomic"

"github.com/pingcap/tiflow/cdc/model"
"github.com/pingcap/tiflow/cdc/redo/common"
"github.com/pingcap/tiflow/pkg/fsutil"
"github.com/pingcap/tiflow/pkg/uuid"
"github.com/stretchr/testify/require"
"github.com/uber-go/atomic"
)

func TestWriterWrite(t *testing.T) {
Expand Down
11 changes: 5 additions & 6 deletions cdc/scheduler/internal/v2/processor_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ import (
"time"

"github.com/pingcap/failpoint"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"

"github.com/pingcap/tiflow/cdc/model"
"github.com/pingcap/tiflow/cdc/scheduler/internal/v2/protocol"
"github.com/pingcap/tiflow/pkg/etcd"
"github.com/pingcap/tiflow/pkg/p2p"
"github.com/pingcap/tiflow/pkg/version"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"
)

const (
Expand Down
21 changes: 10 additions & 11 deletions cdc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tiflow/cdc"
"github.com/pingcap/tiflow/cdc/capture"
"github.com/pingcap/tiflow/cdc/kv"
"github.com/pingcap/tiflow/cdc/processor/pipeline/system"
ssystem "github.com/pingcap/tiflow/cdc/sorter/db/system"
"github.com/pingcap/tiflow/cdc/sorter/unified"
"github.com/pingcap/tiflow/pkg/config"
cerror "github.com/pingcap/tiflow/pkg/errors"
"github.com/pingcap/tiflow/pkg/etcd"
"github.com/pingcap/tiflow/pkg/fsutil"
"github.com/pingcap/tiflow/pkg/p2p"
"github.com/pingcap/tiflow/pkg/pdutil"
"github.com/pingcap/tiflow/pkg/tcpserver"
p2pProto "github.com/pingcap/tiflow/proto/p2p"
pd "github.com/tikv/pd/client"
"go.etcd.io/etcd/client/pkg/v3/logutil"
clientv3 "go.etcd.io/etcd/client/v3"
Expand All @@ -39,17 +49,6 @@ import (
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"

"github.com/pingcap/tiflow/cdc/capture"
"github.com/pingcap/tiflow/cdc/kv"
"github.com/pingcap/tiflow/cdc/sorter/unified"
"github.com/pingcap/tiflow/pkg/config"
cerror "github.com/pingcap/tiflow/pkg/errors"
"github.com/pingcap/tiflow/pkg/etcd"
"github.com/pingcap/tiflow/pkg/fsutil"
"github.com/pingcap/tiflow/pkg/p2p"
"github.com/pingcap/tiflow/pkg/tcpserver"
p2pProto "github.com/pingcap/tiflow/proto/p2p"
)

const (
Expand Down
13 changes: 6 additions & 7 deletions cdc/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@ import (
"time"

"github.com/golang/mock/gomock"
mock_etcd "github.com/pingcap/tiflow/pkg/etcd/mock"
"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/tempurl"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/server/v3/embed"
"golang.org/x/sync/errgroup"

"github.com/pingcap/tiflow/cdc/capture"
"github.com/pingcap/tiflow/cdc/model"
"github.com/pingcap/tiflow/pkg/config"
cerrors "github.com/pingcap/tiflow/pkg/errors"
"github.com/pingcap/tiflow/pkg/etcd"
mock_etcd "github.com/pingcap/tiflow/pkg/etcd/mock"
"github.com/pingcap/tiflow/pkg/httputil"
"github.com/pingcap/tiflow/pkg/retry"
security2 "github.com/pingcap/tiflow/pkg/security"
"github.com/pingcap/tiflow/pkg/util"
"github.com/stretchr/testify/require"
"github.com/tikv/pd/pkg/tempurl"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/server/v3/embed"
"golang.org/x/sync/errgroup"
)

type testServer struct {
Expand Down
3 changes: 1 addition & 2 deletions cdc/sink/mysql/causality.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import (
"encoding/binary"

"github.com/pingcap/log"
"go.uber.org/zap"

"github.com/pingcap/tiflow/cdc/model"
"go.uber.org/zap"
)

const (
Expand Down
7 changes: 3 additions & 4 deletions cdc/sink/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ import (
"github.com/pingcap/tidb/parser/charset"
timodel "github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tiflow/cdc/contextutil"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/atomic"
"go.uber.org/zap"

"github.com/pingcap/tiflow/cdc/model"
"github.com/pingcap/tiflow/cdc/sink/metrics"
dmutils "github.com/pingcap/tiflow/dm/pkg/utils"
Expand All @@ -45,6 +41,9 @@ import (
"github.com/pingcap/tiflow/pkg/notify"
"github.com/pingcap/tiflow/pkg/quotes"
"github.com/pingcap/tiflow/pkg/retry"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/atomic"
"go.uber.org/zap"
)

const (
Expand Down
7 changes: 3 additions & 4 deletions cdc/sink/mysql/mysql_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ import (

"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/atomic"
"go.uber.org/zap"

"github.com/pingcap/tiflow/cdc/model"
cerror "github.com/pingcap/tiflow/pkg/errors"
"github.com/pingcap/tiflow/pkg/notify"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/atomic"
"go.uber.org/zap"
)

type mysqlSinkWorker struct {
Expand Down
3 changes: 1 addition & 2 deletions cmd/dm-master/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import (
"syscall"

"github.com/pingcap/errors"
"go.uber.org/zap"

"github.com/pingcap/tiflow/dm/ctl/common"
"github.com/pingcap/tiflow/dm/master"
"github.com/pingcap/tiflow/dm/pkg/log"
"github.com/pingcap/tiflow/dm/pkg/terror"
"github.com/pingcap/tiflow/dm/pkg/utils"
"github.com/pingcap/tiflow/pkg/version"
"go.uber.org/zap"
)

func main() {
Expand Down
1 change: 0 additions & 1 deletion cmd/dm-syncer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
bf "github.com/pingcap/tidb-tools/pkg/binlog-filter"
"github.com/pingcap/tidb/util/filter"
router "github.com/pingcap/tidb/util/table-router"

"github.com/pingcap/tiflow/dm/config"
"github.com/pingcap/tiflow/dm/pkg/log"
"github.com/pingcap/tiflow/pkg/version"
Expand Down
5 changes: 2 additions & 3 deletions cmd/dm-syncer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ import (
"strings"
"syscall"

"github.com/pingcap/errors"
globalLog "github.com/pingcap/log"
"github.com/pingcap/tiflow/dm/config"
"github.com/pingcap/tiflow/dm/ctl/common"
"github.com/pingcap/tiflow/dm/pb"
"github.com/pingcap/tiflow/dm/pkg/log"
"github.com/pingcap/tiflow/dm/pkg/terror"
"github.com/pingcap/tiflow/dm/syncer"
"github.com/pingcap/tiflow/pkg/version"

"github.com/pingcap/errors"
globalLog "github.com/pingcap/log"
"go.uber.org/zap"
)

Expand Down
3 changes: 1 addition & 2 deletions cmd/dm-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import (

"github.com/pingcap/errors"
globalLog "github.com/pingcap/log"
"go.uber.org/zap"

lightningLog "github.com/pingcap/tidb/br/pkg/lightning/log"
"github.com/pingcap/tiflow/dm/ctl/common"
"github.com/pingcap/tiflow/dm/pkg/log"
"github.com/pingcap/tiflow/dm/pkg/terror"
"github.com/pingcap/tiflow/dm/pkg/utils"
"github.com/pingcap/tiflow/dm/worker"
"github.com/pingcap/tiflow/pkg/version"
"go.uber.org/zap"
)

func main() {
Expand Down
Loading