Skip to content

Commit

Permalink
Feat fix go import (#536)
Browse files Browse the repository at this point in the history
optimize go imports style
  • Loading branch information
wang1309 authored and georgehao committed Apr 8, 2023
1 parent 0d44acb commit ba3b60e
Show file tree
Hide file tree
Showing 64 changed files with 108 additions and 44 deletions.
2 changes: 1 addition & 1 deletion goimports.sh
Expand Up @@ -17,7 +17,7 @@

# format go imports style
go install -v golang.org/x/tools/cmd/goimports
goimports -w .
goimports -local github.com/seata/seata-go -w .

# format licence style
go install github.com/apache/skywalking-eyes/cmd/license-eye@latest
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/datasource/mysql/trigger.go
Expand Up @@ -24,6 +24,7 @@ import (
"strings"

"github.com/pkg/errors"

"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/undo/executor"
)
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/driver_test.go
Expand Up @@ -27,10 +27,11 @@ import (
"github.com/seata/seata-go/pkg/rm"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/mock"
"github.com/seata/seata-go/pkg/protocol/branch"
"github.com/seata/seata-go/pkg/util/reflectx"
"github.com/stretchr/testify/assert"
)

func initMockResourceManager(branchType branch.BranchType, ctrl *gomock.Controller) *mock.MockDataSourceManager {
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/exec/at/base_executor.go
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/test_driver"
gxsort "github.com/dubbogo/gost/sort"

"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/util"
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/exec/at/delete_executor.go
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/format"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/parser"
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/exec/at/delete_executor_test.go
Expand Up @@ -21,11 +21,12 @@ import (
"database/sql/driver"
"testing"

"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/parser"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/util"
"github.com/stretchr/testify/assert"
)

func TestNewDeleteExecutor(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/exec/at/insert_executor_test.go
Expand Up @@ -27,13 +27,14 @@ import (
"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/model"
"github.com/arana-db/parser/test_driver"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/datasource/mysql"
"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/parser"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/util"
"github.com/stretchr/testify/assert"
)

func TestBuildSelectSQLByInsert(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/exec/at/insert_on_update_executor.go
Expand Up @@ -24,6 +24,7 @@ import (
"strings"

"github.com/arana-db/parser/ast"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/types"
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/exec/at/insert_on_update_executor_test.go
Expand Up @@ -21,10 +21,11 @@ import (
"database/sql/driver"
"testing"

"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/parser"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/util"
"github.com/stretchr/testify/assert"
)

func TestInsertOnUpdateBeforeImageSQL(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/exec/at/multi_delete_executor.go
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/format"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/types"
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/exec/at/multi_delete_executor_test.go
Expand Up @@ -21,12 +21,13 @@ import (
"database/sql/driver"
"testing"

"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/parser"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/util"
"github.com/seata/seata-go/pkg/util/log"
"github.com/stretchr/testify/assert"
)

func Test_multiDeleteExecutor_buildBeforeImageSQL(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/exec/at/multi_update_excutor.go
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/arana-db/parser/format"
"github.com/arana-db/parser/model"
"github.com/pkg/errors"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/types"
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/exec/at/multi_update_excutor_test.go
Expand Up @@ -21,14 +21,15 @@ import (
"database/sql/driver"
"testing"

"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/datasource/mysql"
"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/parser"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/undo"
"github.com/seata/seata-go/pkg/datasource/sql/util"
"github.com/stretchr/testify/assert"
)

func TestBuildSelectSQLByMultiUpdate(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/exec/at/plain_executor_test.go
Expand Up @@ -24,10 +24,11 @@ import (
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/exec"
"github.com/seata/seata-go/pkg/datasource/sql/mock"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/stretchr/testify/assert"
)

func TestNewPlainExecutor(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/exec/at/update_executor_test.go
Expand Up @@ -24,6 +24,8 @@ import (
"testing"

"github.com/agiledragon/gomonkey/v2"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/datasource/mysql"
"github.com/seata/seata-go/pkg/datasource/sql/exec"
Expand All @@ -32,7 +34,6 @@ import (
"github.com/seata/seata-go/pkg/datasource/sql/undo"
"github.com/seata/seata-go/pkg/datasource/sql/util"
_ "github.com/seata/seata-go/pkg/util/log"
"github.com/stretchr/testify/assert"
)

func TestBuildSelectSQLByUpdate(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/hook/logger_hook.go
Expand Up @@ -22,9 +22,10 @@ import (

"github.com/seata/seata-go/pkg/datasource/sql/exec"

"go.uber.org/zap"

"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/util/log"
"go.uber.org/zap"
)

func NewLoggerSQLHook() exec.SQLHook {
Expand Down
5 changes: 3 additions & 2 deletions pkg/datasource/sql/mock/mock_datasource_manager.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/datasource/sql/parser/parse_factory_test.go
Expand Up @@ -23,11 +23,13 @@ import (

aparser "github.com/arana-db/parser"
"github.com/arana-db/parser/format"

"github.com/seata/seata-go/pkg/util/bytes"

"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/types"

_ "github.com/arana-db/parser/test_driver"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/parser/parser_factory.go
Expand Up @@ -20,6 +20,7 @@ package parser
import (
aparser "github.com/arana-db/parser"
"github.com/arana-db/parser/ast"

"github.com/seata/seata-go/pkg/datasource/sql/types"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/types/executor.go
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/format"

seatabytes "github.com/seata/seata-go/pkg/util/bytes"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/undo/base/undo.go
Expand Up @@ -28,6 +28,7 @@ import (
"strings"

"github.com/arana-db/parser/mysql"

"github.com/seata/seata-go/pkg/compressor"
"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/types"
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/undo/builder/basic_undo_log_builder.go
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/test_driver"
gxsort "github.com/dubbogo/gost/sort"

"github.com/seata/seata-go/pkg/datasource/sql/types"
)

Expand Down
Expand Up @@ -20,8 +20,9 @@ package builder
import (
"testing"

"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/types"
)

func TestBuildWhereConditionByPKs(t *testing.T) {
Expand Down
Expand Up @@ -28,6 +28,7 @@ import (

"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/format"

"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/util/bytes"
"github.com/seata/seata-go/pkg/util/log"
Expand Down
Expand Up @@ -24,6 +24,7 @@ import (
"strings"

"github.com/arana-db/parser/ast"

"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/undo"
"github.com/seata/seata-go/pkg/datasource/sql/undo/executor"
Expand Down
Expand Up @@ -30,10 +30,11 @@ import (
"github.com/arana-db/parser/model"

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/mock"
"github.com/seata/seata-go/pkg/datasource/sql/parser"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/stretchr/testify/assert"
)

func TestBuildSelectSQLByInsert(t *testing.T) {
Expand Down
Expand Up @@ -24,6 +24,7 @@ import (
"strings"

"github.com/arana-db/parser/ast"

"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/undo"
"github.com/seata/seata-go/pkg/datasource/sql/undo/executor"
Expand Down
Expand Up @@ -23,9 +23,10 @@ import (

"database/sql/driver"

"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/parser"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/stretchr/testify/assert"
)

func TestInsertOnDuplicateBuildBeforeImageSQL(t *testing.T) {
Expand Down
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/arana-db/parser/ast"
"github.com/arana-db/parser/format"
"github.com/arana-db/parser/model"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"

"github.com/seata/seata-go/pkg/datasource/sql/types"
Expand Down
Expand Up @@ -33,8 +33,9 @@ import (
"github.com/seata/seata-go/pkg/datasource/sql/parser"

_ "github.com/arana-db/parser/test_driver"
_ "github.com/seata/seata-go/pkg/util/log"
"github.com/stretchr/testify/assert"

_ "github.com/seata/seata-go/pkg/util/log"
)

func TestBuildSelectSQLByUpdate(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/undo/executor/executor.go
Expand Up @@ -25,6 +25,7 @@ import (
"strings"

"github.com/goccy/go-json"

"github.com/seata/seata-go/pkg/datasource/sql/datasource"
"github.com/seata/seata-go/pkg/datasource/sql/types"
"github.com/seata/seata-go/pkg/datasource/sql/undo"
Expand Down
1 change: 1 addition & 0 deletions pkg/datasource/sql/undo/mysql/default.go
Expand Up @@ -19,6 +19,7 @@ package mysql

import (
"github.com/pkg/errors"

"github.com/seata/seata-go/pkg/datasource/sql/undo"
"github.com/seata/seata-go/pkg/datasource/sql/undo/base"
)
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/undo/parser/parser_json_test.go
Expand Up @@ -20,8 +20,9 @@ package parser
import (
"testing"

"github.com/seata/seata-go/pkg/datasource/sql/undo"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/undo"
)

func TestGetName(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasource/sql/undo_test.go
Expand Up @@ -22,9 +22,10 @@ import (
"database/sql"
"testing"

"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/datasource/sql/undo/base"
"github.com/seata/seata-go/pkg/datasource/sql/undo/mysql"
"github.com/stretchr/testify/assert"
)

// TestBatchDeleteUndoLogs
Expand Down
1 change: 1 addition & 0 deletions pkg/integration/dubbo/dubbo_transaction_filter.go
Expand Up @@ -25,6 +25,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/common/extension"
"dubbo.apache.org/dubbo-go/v3/filter"
"dubbo.apache.org/dubbo-go/v3/protocol"

"github.com/seata/seata-go/pkg/constant"
"github.com/seata/seata-go/pkg/tm"
"github.com/seata/seata-go/pkg/util/log"
Expand Down
3 changes: 2 additions & 1 deletion pkg/protocol/codec/branch_commit_req_codec_test.go
Expand Up @@ -22,8 +22,9 @@ import (

model2 "github.com/seata/seata-go/pkg/protocol/branch"

"github.com/seata/seata-go/pkg/protocol/message"
"github.com/stretchr/testify/assert"

"github.com/seata/seata-go/pkg/protocol/message"
)

func TestBranchCommitRequestCodec(t *testing.T) {
Expand Down

0 comments on commit ba3b60e

Please sign in to comment.