Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore(linter): goimports check bytebase packages after 3rd-party packages (#2414)

Yilong Li1dfef8b62f1c
diff --git a/.golangci.yaml b/.golangci.yaml
index adfc06cb35..1fb87971e6 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -34,6 +34,10 @@ run:
- mysql
linters-settings:
+ goimports:
+ # Put imports beginning with prefix after 3rd-party packages.
+ # It's a comma-separated list of prefixes.
+ local-prefixes: github.com/bytebase/bytebase
revive:
# Default to run all linters so that new rules in the future could automatically be added to the static check.
enable-all-rules: true
diff --git a/.vscode/settings.json b/.vscode/settings.json
index bed7758348..6de146bbf3 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -42,5 +42,8 @@
"i18n-ally.parserOptions": {},
"go.lintOnSave": "workspace",
"go.lintTool": "golangci-lint",
- "go.buildTags": "mysql"
+ "go.buildTags": "mysql",
+ "gopls": {
+ "formatting.local": "github.com/bytebase/bytebase"
+ }
}
diff --git a/api/policy.go b/api/policy.go
index 5029a39c69..196be60ef3 100644
--- a/api/policy.go
+++ b/api/policy.go
@@ -3,8 +3,9 @@ package api
import (
"encoding/json"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
// PolicyType is the type or name of a policy.
diff --git a/api/project_test.go b/api/project_test.go
index 93ce1917ea..2a3a92e5e2 100644
--- a/api/project_test.go
+++ b/api/project_test.go
@@ -3,8 +3,9 @@ package api
import (
"testing"
- "github.com/bytebase/bytebase/common"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/common"
)
func TestGetTemplateTokens(t *testing.T) {
diff --git a/bin/bb/cmd/dump_test.go b/bin/bb/cmd/dump_test.go
index 67f46d4250..f10e52c333 100644
--- a/bin/bb/cmd/dump_test.go
+++ b/bin/bb/cmd/dump_test.go
@@ -10,8 +10,9 @@ import (
// Embedded expected output.
_ "embed"
- "github.com/bytebase/bytebase/resources/mysql"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/resources/mysql"
)
var (
diff --git a/bin/bb/cmd/migrate.go b/bin/bb/cmd/migrate.go
index 3aa01309fc..51bfdd4d2b 100644
--- a/bin/bb/cmd/migrate.go
+++ b/bin/bb/cmd/migrate.go
@@ -8,11 +8,12 @@ import (
"os/user"
"strings"
- "github.com/bytebase/bytebase/common"
- "github.com/bytebase/bytebase/plugin/db"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/xo/dburl"
+
+ "github.com/bytebase/bytebase/common"
+ "github.com/bytebase/bytebase/plugin/db"
)
func newMigrateCmd() *cobra.Command {
diff --git a/bin/bb/cmd/migrate_test.go b/bin/bb/cmd/migrate_test.go
index 2714568dd8..6d949335ca 100644
--- a/bin/bb/cmd/migrate_test.go
+++ b/bin/bb/cmd/migrate_test.go
@@ -7,9 +7,10 @@ import (
"fmt"
"testing"
- "github.com/bytebase/bytebase/resources/mysql"
"github.com/stretchr/testify/require"
+ "github.com/bytebase/bytebase/resources/mysql"
+
// embed expected output.
_ "embed"
)
diff --git a/bin/bb/cmd/root.go b/bin/bb/cmd/root.go
index 53147e68bb..903c1d6e47 100644
--- a/bin/bb/cmd/root.go
+++ b/bin/bb/cmd/root.go
@@ -2,8 +2,9 @@
package cmd
import (
- "github.com/bytebase/bytebase/common/log"
"github.com/spf13/cobra"
+
+ "github.com/bytebase/bytebase/common/log"
)
// NewRootCmd creates the root command.
diff --git a/bin/bb/cmd/root_test.go b/bin/bb/cmd/root_test.go
index be2e8350d1..ba59b2c6a3 100644
--- a/bin/bb/cmd/root_test.go
+++ b/bin/bb/cmd/root_test.go
@@ -7,11 +7,12 @@ import (
"strings"
"testing"
- "github.com/bytebase/bytebase/common/log"
_ "github.com/go-sql-driver/mysql"
"github.com/google/go-cmp/cmp"
"github.com/spf13/cobra"
"go.uber.org/zap"
+
+ "github.com/bytebase/bytebase/common/log"
)
const (
diff --git a/bin/bb/cmd/utils.go b/bin/bb/cmd/utils.go
index 56e425151a..9c66d25eec 100644
--- a/bin/bb/cmd/utils.go
+++ b/bin/bb/cmd/utils.go
@@ -4,16 +4,18 @@ import (
"context"
"os"
+ "github.com/pkg/errors"
+ "github.com/xo/dburl"
+
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/resources/mysqlutil"
"github.com/bytebase/bytebase/resources/postgres"
- "github.com/pkg/errors"
// install mysql driver.
_ "github.com/bytebase/bytebase/plugin/db/mysql"
- // install pg driver.
+ // register pg driver.
_ "github.com/bytebase/bytebase/plugin/db/pg"
- "github.com/xo/dburl"
+ // install pg driver.
)
func getDatabase(u *dburl.URL) string {
diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.go
index 3a97fe16a2..59944d9745 100644
--- a/bin/server/cmd/root.go
+++ b/bin/server/cmd/root.go
@@ -11,13 +11,14 @@ import (
"strings"
"syscall"
- "github.com/bytebase/bytebase/common"
- "github.com/bytebase/bytebase/common/log"
- "github.com/bytebase/bytebase/server"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"go.uber.org/zap"
+ "github.com/bytebase/bytebase/common"
+ "github.com/bytebase/bytebase/common/log"
+ "github.com/bytebase/bytebase/server"
+
// Register clickhouse driver.
_ "github.com/bytebase/bytebase/plugin/db/clickhouse"
// Register mysql driver.
diff --git a/bin/sql-service/cmd/root.go b/bin/sql-service/cmd/root.go
index 01164600cb..0ca139c033 100644
--- a/bin/sql-service/cmd/root.go
+++ b/bin/sql-service/cmd/root.go
@@ -9,11 +9,12 @@ import (
"os/signal"
"syscall"
+ "github.com/spf13/cobra"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
server "github.com/bytebase/bytebase/sql-server"
- "github.com/spf13/cobra"
- "go.uber.org/zap"
// Register pingcap parser driver.
_ "github.com/pingcap/tidb/types/parser_driver"
diff --git a/enterprise/api/license.go b/enterprise/api/license.go
index 6ce87afcdb..0dbeef9e33 100644
--- a/enterprise/api/license.go
+++ b/enterprise/api/license.go
@@ -5,8 +5,9 @@ import (
"strings"
"time"
- "github.com/bytebase/bytebase/api"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/api"
)
// validPlans is a string array of valid plan types.
diff --git a/enterprise/config/config.go b/enterprise/config/config.go
index a0325ad436..2b96a7b144 100644
--- a/enterprise/config/config.go
+++ b/enterprise/config/config.go
@@ -6,10 +6,11 @@ import (
"fmt"
"io/fs"
- "github.com/bytebase/bytebase/common"
- "github.com/bytebase/bytebase/common/log"
"github.com/pkg/errors"
"go.uber.org/zap"
+
+ "github.com/bytebase/bytebase/common"
+ "github.com/bytebase/bytebase/common/log"
)
//go:embed keys
diff --git a/metric/collector/instance_count.go b/metric/collector/instance_count.go
index 1fc44bfc11..3e6590c9c9 100644
--- a/metric/collector/instance_count.go
+++ b/metric/collector/instance_count.go
@@ -3,11 +3,12 @@ package collector
import (
"context"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common/log"
metricAPI "github.com/bytebase/bytebase/metric"
"github.com/bytebase/bytebase/plugin/metric"
"github.com/bytebase/bytebase/store"
- "go.uber.org/zap"
)
var _ metric.Collector = (*instanceCountCollector)(nil)
diff --git a/plugin/advisor/advisor.go b/plugin/advisor/advisor.go
index 5cb4c0babf..51618718d8 100644
--- a/plugin/advisor/advisor.go
+++ b/plugin/advisor/advisor.go
@@ -6,10 +6,11 @@ import (
"fmt"
"sync"
- "github.com/bytebase/bytebase/plugin/advisor/catalog"
- "github.com/bytebase/bytebase/plugin/advisor/db"
"github.com/pkg/errors"
"go.uber.org/zap/zapcore"
+
+ "github.com/bytebase/bytebase/plugin/advisor/catalog"
+ "github.com/bytebase/bytebase/plugin/advisor/db"
)
// Status is the advisor result status.
diff --git a/plugin/advisor/mysql/advisor_column_disallow_changing_type.go b/plugin/advisor/mysql/advisor_column_disallow_changing_type.go
index 6da0c5af0b..367297e417 100644
--- a/plugin/advisor/mysql/advisor_column_disallow_changing_type.go
+++ b/plugin/advisor/mysql/advisor_column_disallow_changing_type.go
@@ -1,9 +1,10 @@
package mysql
import (
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_column_no_null.go b/plugin/advisor/mysql/advisor_column_no_null.go
index 9c2adc089e..16697f6466 100644
--- a/plugin/advisor/mysql/advisor_column_no_null.go
+++ b/plugin/advisor/mysql/advisor_column_no_null.go
@@ -3,9 +3,10 @@ package mysql
import (
"fmt"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_column_required.go b/plugin/advisor/mysql/advisor_column_required.go
index 2e31eadf39..f3cb625ce3 100644
--- a/plugin/advisor/mysql/advisor_column_required.go
+++ b/plugin/advisor/mysql/advisor_column_required.go
@@ -5,9 +5,10 @@ import (
"sort"
"strings"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_column_required_test.go b/plugin/advisor/mysql/advisor_column_required_test.go
index fe8dbea93a..4ae776b8ac 100644
--- a/plugin/advisor/mysql/advisor_column_required_test.go
+++ b/plugin/advisor/mysql/advisor_column_required_test.go
@@ -4,8 +4,9 @@ import (
"encoding/json"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestColumnRequirement(t *testing.T) {
diff --git a/plugin/advisor/mysql/advisor_database_drop_empty_db.go b/plugin/advisor/mysql/advisor_database_drop_empty_db.go
index ff01d4a919..b411593b30 100644
--- a/plugin/advisor/mysql/advisor_database_drop_empty_db.go
+++ b/plugin/advisor/mysql/advisor_database_drop_empty_db.go
@@ -3,10 +3,11 @@ package mysql
import (
"fmt"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_naming_column.go b/plugin/advisor/mysql/advisor_naming_column.go
index f514a9b554..de98190bb4 100644
--- a/plugin/advisor/mysql/advisor_naming_column.go
+++ b/plugin/advisor/mysql/advisor_naming_column.go
@@ -4,9 +4,10 @@ import (
"fmt"
"regexp"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_naming_column_test.go b/plugin/advisor/mysql/advisor_naming_column_test.go
index 43516032b0..5510efa4b1 100644
--- a/plugin/advisor/mysql/advisor_naming_column_test.go
+++ b/plugin/advisor/mysql/advisor_naming_column_test.go
@@ -5,8 +5,9 @@ import (
"fmt"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingColumnConvention(t *testing.T) {
diff --git a/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go b/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go
index 3eac6275e1..db531aab22 100644
--- a/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go
+++ b/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go
@@ -4,9 +4,10 @@ import (
"fmt"
"strings"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.go b/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.go
index 3fb2220286..6f719913be 100644
--- a/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.go
+++ b/plugin/advisor/mysql/advisor_naming_foreign_key_convention_test.go
@@ -5,8 +5,9 @@ import (
"fmt"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingFKConvention(t *testing.T) {
diff --git a/plugin/advisor/mysql/advisor_naming_index_convention.go b/plugin/advisor/mysql/advisor_naming_index_convention.go
index 47eb96d1ff..7ab29f0421 100644
--- a/plugin/advisor/mysql/advisor_naming_index_convention.go
+++ b/plugin/advisor/mysql/advisor_naming_index_convention.go
@@ -5,10 +5,11 @@ import (
"regexp"
"strings"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_naming_index_convention_test.go b/plugin/advisor/mysql/advisor_naming_index_convention_test.go
index 0af5088c31..131da855f2 100644
--- a/plugin/advisor/mysql/advisor_naming_index_convention_test.go
+++ b/plugin/advisor/mysql/advisor_naming_index_convention_test.go
@@ -6,8 +6,9 @@ import (
"strings"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingIndexConvention(t *testing.T) {
diff --git a/plugin/advisor/mysql/advisor_naming_table.go b/plugin/advisor/mysql/advisor_naming_table.go
index 99330d5476..2e852f0e2e 100644
--- a/plugin/advisor/mysql/advisor_naming_table.go
+++ b/plugin/advisor/mysql/advisor_naming_table.go
@@ -4,9 +4,10 @@ import (
"fmt"
"regexp"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_naming_table_test.go b/plugin/advisor/mysql/advisor_naming_table_test.go
index d6d81c9bd8..623875c3a6 100644
--- a/plugin/advisor/mysql/advisor_naming_table_test.go
+++ b/plugin/advisor/mysql/advisor_naming_table_test.go
@@ -5,8 +5,9 @@ import (
"fmt"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestMySQLNamingTableConvention(t *testing.T) {
diff --git a/plugin/advisor/mysql/advisor_naming_unique_key_convention.go b/plugin/advisor/mysql/advisor_naming_unique_key_convention.go
index c06f9afe8b..87bcf6273c 100644
--- a/plugin/advisor/mysql/advisor_naming_unique_key_convention.go
+++ b/plugin/advisor/mysql/advisor_naming_unique_key_convention.go
@@ -4,10 +4,11 @@ import (
"fmt"
"strings"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.go b/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.go
index c01f786d99..1be026e3c9 100644
--- a/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.go
+++ b/plugin/advisor/mysql/advisor_naming_unique_key_convention_test.go
@@ -6,8 +6,9 @@ import (
"strings"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingUKConvention(t *testing.T) {
diff --git a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go
index 741721a2f1..2881ae9d8f 100644
--- a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go
+++ b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go
@@ -3,10 +3,11 @@ package mysql
import (
"fmt"
- "github.com/bytebase/bytebase/plugin/advisor"
- "github.com/bytebase/bytebase/plugin/advisor/db"
"github.com/pingcap/tidb/parser/ast"
"github.com/pingcap/tidb/parser/format"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
+ "github.com/bytebase/bytebase/plugin/advisor/db"
)
const (
diff --git a/plugin/advisor/mysql/advisor_stmt_no_select_all.go b/plugin/advisor/mysql/advisor_stmt_no_select_all.go
index 4c45715a40..65f9cf00df 100644
--- a/plugin/advisor/mysql/advisor_stmt_no_select_all.go
+++ b/plugin/advisor/mysql/advisor_stmt_no_select_all.go
@@ -3,9 +3,10 @@ package mysql
import (
"fmt"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_table_drop_naming_convention.go b/plugin/advisor/mysql/advisor_table_drop_naming_convention.go
index bcbf97ee07..e1d2187065 100644
--- a/plugin/advisor/mysql/advisor_table_drop_naming_convention.go
+++ b/plugin/advisor/mysql/advisor_table_drop_naming_convention.go
@@ -4,9 +4,10 @@ import (
"fmt"
"regexp"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_table_drop_naming_convention_test.go b/plugin/advisor/mysql/advisor_table_drop_naming_convention_test.go
index 438908916c..ff0ed7f676 100644
--- a/plugin/advisor/mysql/advisor_table_drop_naming_convention_test.go
+++ b/plugin/advisor/mysql/advisor_table_drop_naming_convention_test.go
@@ -4,8 +4,9 @@ import (
"encoding/json"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestMySQLTableDropNamingConvention(t *testing.T) {
diff --git a/plugin/advisor/mysql/advisor_table_no_fk.go b/plugin/advisor/mysql/advisor_table_no_fk.go
index df77c3f5f8..186c719582 100644
--- a/plugin/advisor/mysql/advisor_table_no_fk.go
+++ b/plugin/advisor/mysql/advisor_table_no_fk.go
@@ -3,9 +3,10 @@ package mysql
import (
"fmt"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
var (
diff --git a/plugin/advisor/mysql/advisor_table_require_pk.go b/plugin/advisor/mysql/advisor_table_require_pk.go
index a9eea2bb00..470125ef77 100644
--- a/plugin/advisor/mysql/advisor_table_require_pk.go
+++ b/plugin/advisor/mysql/advisor_table_require_pk.go
@@ -4,10 +4,11 @@ import (
"fmt"
"strings"
+ "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pingcap/tidb/parser/ast"
)
const (
diff --git a/plugin/advisor/mysql/advisor_use_innodb.go b/plugin/advisor/mysql/advisor_use_innodb.go
index 86928173ff..f58dc1efa2 100644
--- a/plugin/advisor/mysql/advisor_use_innodb.go
+++ b/plugin/advisor/mysql/advisor_use_innodb.go
@@ -4,10 +4,11 @@ import (
"fmt"
"strings"
- "github.com/bytebase/bytebase/plugin/advisor"
- "github.com/bytebase/bytebase/plugin/advisor/db"
"github.com/pingcap/tidb/parser/ast"
"github.com/pingcap/tidb/parser/format"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
+ "github.com/bytebase/bytebase/plugin/advisor/db"
)
const (
diff --git a/plugin/advisor/mysql/parser.go b/plugin/advisor/mysql/parser.go
index 15c81035c0..c845fa486e 100644
--- a/plugin/advisor/mysql/parser.go
+++ b/plugin/advisor/mysql/parser.go
@@ -3,10 +3,11 @@ package mysql
import (
"fmt"
- "github.com/bytebase/bytebase/plugin/advisor"
- "github.com/bytebase/bytebase/plugin/parser"
tidbparser "github.com/pingcap/tidb/parser"
"github.com/pingcap/tidb/parser/ast"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
+ "github.com/bytebase/bytebase/plugin/parser"
)
// Wrapper for parser.New().
diff --git a/plugin/advisor/pg/advisor_column_required_test.go b/plugin/advisor/pg/advisor_column_required_test.go
index 19161d005f..8f8e6fc2cd 100644
--- a/plugin/advisor/pg/advisor_column_required_test.go
+++ b/plugin/advisor/pg/advisor_column_required_test.go
@@ -4,8 +4,9 @@ import (
"encoding/json"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestColumnRequirement(t *testing.T) {
diff --git a/plugin/advisor/pg/advisor_naming_column_test.go b/plugin/advisor/pg/advisor_naming_column_test.go
index 1ce944bba2..57f81444e0 100644
--- a/plugin/advisor/pg/advisor_naming_column_test.go
+++ b/plugin/advisor/pg/advisor_naming_column_test.go
@@ -5,8 +5,9 @@ import (
"fmt"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingColumnConvention(t *testing.T) {
diff --git a/plugin/advisor/pg/advisor_naming_foreign_key_convention_test.go b/plugin/advisor/pg/advisor_naming_foreign_key_convention_test.go
index 52a37b93cf..a0e4004205 100644
--- a/plugin/advisor/pg/advisor_naming_foreign_key_convention_test.go
+++ b/plugin/advisor/pg/advisor_naming_foreign_key_convention_test.go
@@ -5,8 +5,9 @@ import (
"fmt"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingFKConvention(t *testing.T) {
diff --git a/plugin/advisor/pg/advisor_naming_index_convention_test.go b/plugin/advisor/pg/advisor_naming_index_convention_test.go
index 3fbc1b6568..6d787d18e0 100644
--- a/plugin/advisor/pg/advisor_naming_index_convention_test.go
+++ b/plugin/advisor/pg/advisor_naming_index_convention_test.go
@@ -6,8 +6,9 @@ import (
"strings"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingIndexConvention(t *testing.T) {
diff --git a/plugin/advisor/pg/advisor_naming_primary_key_convention_test.go b/plugin/advisor/pg/advisor_naming_primary_key_convention_test.go
index 4f36b6fc5e..790203ae35 100644
--- a/plugin/advisor/pg/advisor_naming_primary_key_convention_test.go
+++ b/plugin/advisor/pg/advisor_naming_primary_key_convention_test.go
@@ -6,8 +6,9 @@ import (
"strings"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingPKConvention(t *testing.T) {
diff --git a/plugin/advisor/pg/advisor_naming_table_test.go b/plugin/advisor/pg/advisor_naming_table_test.go
index d624ce57ca..674f6e186d 100644
--- a/plugin/advisor/pg/advisor_naming_table_test.go
+++ b/plugin/advisor/pg/advisor_naming_table_test.go
@@ -5,8 +5,9 @@ import (
"fmt"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestPostgreSQLNamingTableConvention(t *testing.T) {
diff --git a/plugin/advisor/pg/advisor_naming_unique_key_convention_test.go b/plugin/advisor/pg/advisor_naming_unique_key_convention_test.go
index 4de4073fea..020e29e79d 100644
--- a/plugin/advisor/pg/advisor_naming_unique_key_convention_test.go
+++ b/plugin/advisor/pg/advisor_naming_unique_key_convention_test.go
@@ -6,8 +6,9 @@ import (
"strings"
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor"
)
func TestNamingUKConvention(t *testing.T) {
diff --git a/plugin/advisor/pg/advisor_syntax_test.go b/plugin/advisor/pg/advisor_syntax_test.go
index 73be0d2f89..582d1bf690 100644
--- a/plugin/advisor/pg/advisor_syntax_test.go
+++ b/plugin/advisor/pg/advisor_syntax_test.go
@@ -3,10 +3,11 @@ package pg
import (
"testing"
- "github.com/bytebase/bytebase/plugin/advisor"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "github.com/bytebase/bytebase/plugin/advisor"
+
_ "github.com/bytebase/bytebase/plugin/parser/engine/pg"
)
diff --git a/plugin/advisor/sql_review.go b/plugin/advisor/sql_review.go
index a51415ba91..5090663d21 100644
--- a/plugin/advisor/sql_review.go
+++ b/plugin/advisor/sql_review.go
@@ -6,9 +6,10 @@ import (
"log"
"regexp"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/plugin/advisor/catalog"
"github.com/bytebase/bytebase/plugin/advisor/db"
- "github.com/pkg/errors"
)
// How to add a SQL review rule:
diff --git a/plugin/advisor/utils_for_tests.go b/plugin/advisor/utils_for_tests.go
index acb53ac117..c49c10a395 100644
--- a/plugin/advisor/utils_for_tests.go
+++ b/plugin/advisor/utils_for_tests.go
@@ -5,10 +5,11 @@ import (
"testing"
"time"
- "github.com/bytebase/bytebase/plugin/advisor/catalog"
- "github.com/bytebase/bytebase/plugin/advisor/db"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/plugin/advisor/catalog"
+ "github.com/bytebase/bytebase/plugin/advisor/db"
)
const (
diff --git a/plugin/db/clickhouse/clickhouse.go b/plugin/db/clickhouse/clickhouse.go
index d5110fdc7e..833fc16146 100644
--- a/plugin/db/clickhouse/clickhouse.go
+++ b/plugin/db/clickhouse/clickhouse.go
@@ -9,12 +9,13 @@ import (
"time"
clickhouse "github.com/ClickHouse/clickhouse-go/v2"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
var (
diff --git a/plugin/db/clickhouse/dump.go b/plugin/db/clickhouse/dump.go
index 4b3544dd1e..d3c7459615 100644
--- a/plugin/db/clickhouse/dump.go
+++ b/plugin/db/clickhouse/dump.go
@@ -7,9 +7,10 @@ import (
"io"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
)
// Dump and restore.
diff --git a/plugin/db/clickhouse/migrate.go b/plugin/db/clickhouse/migrate.go
index d0d7419e8a..8edaff985d 100644
--- a/plugin/db/clickhouse/migrate.go
+++ b/plugin/db/clickhouse/migrate.go
@@ -9,11 +9,12 @@ import (
// embed will embeds the migration schema.
_ "embed"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "go.uber.org/zap"
)
var (
diff --git a/plugin/db/driver.go b/plugin/db/driver.go
index e8a22af367..1fd890a19d 100644
--- a/plugin/db/driver.go
+++ b/plugin/db/driver.go
@@ -10,8 +10,9 @@ import (
"strings"
"sync"
- "github.com/bytebase/bytebase/plugin/vcs"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/vcs"
)
// Type is the type of a database.
diff --git a/plugin/db/mysql/dump.go b/plugin/db/mysql/dump.go
index eed635d9b4..ebcbd89e57 100644
--- a/plugin/db/mysql/dump.go
+++ b/plugin/db/mysql/dump.go
@@ -14,12 +14,13 @@ import (
"go.uber.org/zap"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db/util"
"github.com/bytebase/bytebase/resources/mysqlutil"
- "github.com/pkg/errors"
)
// Dump and restore.
diff --git a/plugin/db/mysql/migrate.go b/plugin/db/mysql/migrate.go
index 37dc08291c..b03aca95c5 100644
--- a/plugin/db/mysql/migrate.go
+++ b/plugin/db/mysql/migrate.go
@@ -8,11 +8,12 @@ import (
// embed will embeds the migration schema.
_ "embed"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "go.uber.org/zap"
)
var (
diff --git a/plugin/db/mysql/mysql.go b/plugin/db/mysql/mysql.go
index 03bae06075..08628e05d0 100644
--- a/plugin/db/mysql/mysql.go
+++ b/plugin/db/mysql/mysql.go
@@ -7,13 +7,14 @@ import (
"fmt"
"strings"
+ "github.com/go-sql-driver/mysql"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/go-sql-driver/mysql"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
var (
diff --git a/plugin/db/mysql/restore.go b/plugin/db/mysql/restore.go
index 370bff3150..db8cabc775 100644
--- a/plugin/db/mysql/restore.go
+++ b/plugin/db/mysql/restore.go
@@ -28,13 +28,14 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db/util"
bbs3 "github.com/bytebase/bytebase/plugin/storage/s3"
"github.com/bytebase/bytebase/resources/mysqlutil"
- "github.com/pkg/errors"
"github.com/blang/semver/v4"
)
diff --git a/plugin/db/mysql/restore_test.go b/plugin/db/mysql/restore_test.go
index 031ab530b2..a51d69b586 100644
--- a/plugin/db/mysql/restore_test.go
+++ b/plugin/db/mysql/restore_test.go
@@ -6,9 +6,10 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/require"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/stretchr/testify/require"
)
func TestGetSafeName(t *testing.T) {
diff --git a/plugin/db/pg/dump.go b/plugin/db/pg/dump.go
index 607b514325..ac6bfe86fa 100644
--- a/plugin/db/pg/dump.go
+++ b/plugin/db/pg/dump.go
@@ -10,9 +10,10 @@ import (
"path/filepath"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/parser"
- "github.com/pkg/errors"
)
// Dump dumps the database.
diff --git a/plugin/db/pg/migrate.go b/plugin/db/pg/migrate.go
index 6becb302d1..c9a67c2268 100644
--- a/plugin/db/pg/migrate.go
+++ b/plugin/db/pg/migrate.go
@@ -8,11 +8,12 @@ import (
// embed will embeds the migration schema.
_ "embed"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
var (
diff --git a/plugin/db/pg/sync.go b/plugin/db/pg/sync.go
index d8dbe4d185..912dcbf7ad 100644
--- a/plugin/db/pg/sync.go
+++ b/plugin/db/pg/sync.go
@@ -8,10 +8,11 @@ import (
"strings"
"time"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
)
var (
diff --git a/plugin/db/snowflake/dump.go b/plugin/db/snowflake/dump.go
index 4dcc9a496b..e0d6b53f67 100644
--- a/plugin/db/snowflake/dump.go
+++ b/plugin/db/snowflake/dump.go
@@ -7,8 +7,9 @@ import (
"io"
"strings"
- "github.com/bytebase/bytebase/plugin/db/util"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/db/util"
)
// Dump and restore.
diff --git a/plugin/db/snowflake/migrate.go b/plugin/db/snowflake/migrate.go
index 4b91719316..28dc1993a5 100644
--- a/plugin/db/snowflake/migrate.go
+++ b/plugin/db/snowflake/migrate.go
@@ -8,11 +8,12 @@ import (
// embed will embeds the migration schema.
_ "embed"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "go.uber.org/zap"
)
var (
diff --git a/plugin/db/snowflake/snowflake.go b/plugin/db/snowflake/snowflake.go
index bb4de677d5..a2d1f28768 100644
--- a/plugin/db/snowflake/snowflake.go
+++ b/plugin/db/snowflake/snowflake.go
@@ -7,11 +7,12 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
snow "github.com/snowflakedb/gosnowflake"
"go.uber.org/zap"
diff --git a/plugin/db/sqlite/dump.go b/plugin/db/sqlite/dump.go
index 7fe5b9e258..895f84ecbe 100644
--- a/plugin/db/sqlite/dump.go
+++ b/plugin/db/sqlite/dump.go
@@ -7,8 +7,9 @@ import (
"io"
"strings"
- "github.com/bytebase/bytebase/plugin/db/util"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/db/util"
)
// Dump dumps the database.
diff --git a/plugin/db/sqlite/migrate.go b/plugin/db/sqlite/migrate.go
index a6b33e641f..f3fc66b7d3 100644
--- a/plugin/db/sqlite/migrate.go
+++ b/plugin/db/sqlite/migrate.go
@@ -8,12 +8,13 @@ import (
// embed will embeds the migration schema.
_ "embed"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
var (
diff --git a/plugin/db/sqlite/sync.go b/plugin/db/sqlite/sync.go
index a0ae46fda2..8d4cc31bba 100644
--- a/plugin/db/sqlite/sync.go
+++ b/plugin/db/sqlite/sync.go
@@ -6,10 +6,11 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
)
var (
diff --git a/plugin/parser/engine/pg/convert.go b/plugin/parser/engine/pg/convert.go
index 3e0db0d183..3e7ff495b1 100644
--- a/plugin/parser/engine/pg/convert.go
+++ b/plugin/parser/engine/pg/convert.go
@@ -1,10 +1,11 @@
package pg
import (
- "github.com/bytebase/bytebase/plugin/parser"
- "github.com/bytebase/bytebase/plugin/parser/ast"
pgquery "github.com/pganalyze/pg_query_go/v2"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/parser"
+ "github.com/bytebase/bytebase/plugin/parser/ast"
)
// convert converts the pg_query.Node to ast.Node.
diff --git a/plugin/parser/engine/pg/convert_test.go b/plugin/parser/engine/pg/convert_test.go
index e6035b8cdc..b6e84ae762 100644
--- a/plugin/parser/engine/pg/convert_test.go
+++ b/plugin/parser/engine/pg/convert_test.go
@@ -3,9 +3,10 @@ package pg
import (
"testing"
+ "github.com/stretchr/testify/require"
+
"github.com/bytebase/bytebase/plugin/parser"
"github.com/bytebase/bytebase/plugin/parser/ast"
- "github.com/stretchr/testify/require"
)
type testData struct {
diff --git a/plugin/parser/engine/pg/parser.go b/plugin/parser/engine/pg/parser.go
index 68a44d0cc6..bf9de8b0f3 100644
--- a/plugin/parser/engine/pg/parser.go
+++ b/plugin/parser/engine/pg/parser.go
@@ -2,10 +2,11 @@
package pg
import (
- "github.com/bytebase/bytebase/plugin/parser"
- "github.com/bytebase/bytebase/plugin/parser/ast"
pgquery "github.com/pganalyze/pg_query_go/v2"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/parser"
+ "github.com/bytebase/bytebase/plugin/parser/ast"
)
var (
diff --git a/plugin/parser/set_line_for_create_table_test.go b/plugin/parser/set_line_for_create_table_test.go
index 1cb4b33d97..78ad6a6f99 100644
--- a/plugin/parser/set_line_for_create_table_test.go
+++ b/plugin/parser/set_line_for_create_table_test.go
@@ -3,12 +3,13 @@ package parser_test
import (
"testing"
- "github.com/bytebase/bytebase/plugin/parser"
- "github.com/bytebase/bytebase/plugin/parser/ast"
tidbparser "github.com/pingcap/tidb/parser"
tidbast "github.com/pingcap/tidb/parser/ast"
"github.com/stretchr/testify/require"
+ "github.com/bytebase/bytebase/plugin/parser"
+ "github.com/bytebase/bytebase/plugin/parser/ast"
+
// Register postgres parser driver.
_ "github.com/bytebase/bytebase/plugin/parser/engine/pg"
// Register pingcap parser driver.
diff --git a/plugin/parser/tokenizer.go b/plugin/parser/tokenizer.go
index c077b6da23..ebbd6511a6 100644
--- a/plugin/parser/tokenizer.go
+++ b/plugin/parser/tokenizer.go
@@ -7,9 +7,10 @@ import (
"strings"
"unicode"
- "github.com/bytebase/bytebase/plugin/parser/ast"
tidbast "github.com/pingcap/tidb/parser/ast"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/parser/ast"
)
const (
diff --git a/plugin/parser/utils.go b/plugin/parser/utils.go
index ff9c21a49b..a736f471ce 100644
--- a/plugin/parser/utils.go
+++ b/plugin/parser/utils.go
@@ -3,9 +3,10 @@ package parser
import (
"io"
- "github.com/bytebase/bytebase/plugin/parser/ast"
tidbast "github.com/pingcap/tidb/parser/ast"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/plugin/parser/ast"
)
// SingleSQL is a separate SQL split from multi-SQL.
diff --git a/plugin/storage/s3/s3_test.go b/plugin/storage/s3/s3_test.go
index b9a88f1529..0947dc8850 100644
--- a/plugin/storage/s3/s3_test.go
+++ b/plugin/storage/s3/s3_test.go
@@ -7,9 +7,10 @@ import (
"testing"
"github.com/aws/aws-sdk-go-v2/aws"
- "github.com/bytebase/bytebase/common/log"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
+
+ "github.com/bytebase/bytebase/common/log"
)
const (
diff --git a/resources/mysql/mysql.go b/resources/mysql/mysql.go
index 60f5b053e4..4d3ee3270a 100644
--- a/resources/mysql/mysql.go
+++ b/resources/mysql/mysql.go
@@ -16,9 +16,10 @@ import (
"testing"
"time"
- "github.com/bytebase/bytebase/resources/utils"
"github.com/pkg/errors"
+ "github.com/bytebase/bytebase/resources/utils"
+
// install mysql driver.
_ "github.com/go-sql-driver/mysql"
)
diff --git a/resources/mysqlutil/mysqlutil.go b/resources/mysqlutil/mysqlutil.go
index 3b0bf483ba..d7bb0a1c96 100644
--- a/resources/mysqlutil/mysqlutil.go
+++ b/resources/mysqlutil/mysqlutil.go
@@ -11,8 +11,9 @@ import (
"runtime"
"strings"
- "github.com/bytebase/bytebase/resources/utils"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/resources/utils"
)
type binaryName string
diff --git a/resources/postgres/postgres.go b/resources/postgres/postgres.go
index b23fe32daa..9a2d8c184e 100644
--- a/resources/postgres/postgres.go
+++ b/resources/postgres/postgres.go
@@ -15,9 +15,10 @@ import (
"syscall"
"testing"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/resources/utils"
- "github.com/pkg/errors"
)
// Instance is a postgres instance installed by bytebase
diff --git a/server/acl.go b/server/acl.go
index 5757f056e6..152cee0b11 100644
--- a/server/acl.go
+++ b/server/acl.go
@@ -10,9 +10,10 @@ import (
"github.com/casbin/casbin/v2"
"github.com/pkg/errors"
+ "github.com/labstack/echo/v4"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/labstack/echo/v4"
)
const (
diff --git a/server/actuator.go b/server/actuator.go
index 19ba960291..e81a15e424 100644
--- a/server/actuator.go
+++ b/server/actuator.go
@@ -5,8 +5,9 @@ import (
"strconv"
"strings"
- "github.com/bytebase/bytebase/api"
"github.com/labstack/echo/v4"
+
+ "github.com/bytebase/bytebase/api"
)
// demoDataPath is the path prefix for demo data.
diff --git a/server/anomaly_scanner.go b/server/anomaly_scanner.go
index f47d7de9f7..0bcedd6f38 100644
--- a/server/anomaly_scanner.go
+++ b/server/anomaly_scanner.go
@@ -8,12 +8,13 @@ import (
"sync"
"time"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
const (
diff --git a/server/backup_runner.go b/server/backup_runner.go
index e14e5650be..97ecd30e23 100644
--- a/server/backup_runner.go
+++ b/server/backup_runner.go
@@ -11,13 +11,14 @@ import (
"sync"
"time"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/mysql"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// NewBackupRunner creates a new backup runner.
diff --git a/server/cache.go b/server/cache.go
index 91a9da1ee1..cbdb4437fa 100644
--- a/server/cache.go
+++ b/server/cache.go
@@ -6,8 +6,9 @@ import (
"encoding/gob"
"github.com/VictoriaMetrics/fastcache"
- "github.com/bytebase/bytebase/api"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/api"
)
var (
diff --git a/server/database_test.go b/server/database_test.go
index e58dc8d9ea..f714dbdb7a 100644
--- a/server/database_test.go
+++ b/server/database_test.go
@@ -3,8 +3,9 @@ package server
import (
"testing"
- "github.com/bytebase/bytebase/api"
"github.com/stretchr/testify/assert"
+
+ "github.com/bytebase/bytebase/api"
)
func TestValidateDatabaseLabelList(t *testing.T) {
diff --git a/server/debug.go b/server/debug.go
index b7015d41e5..2de732c384 100644
--- a/server/debug.go
+++ b/server/debug.go
@@ -3,11 +3,12 @@ package server
import (
"net/http"
- "github.com/bytebase/bytebase/api"
- "github.com/bytebase/bytebase/common/log"
"github.com/google/jsonapi"
"github.com/labstack/echo/v4"
"go.uber.org/zap"
+
+ "github.com/bytebase/bytebase/api"
+ "github.com/bytebase/bytebase/common/log"
)
func (s *Server) registerDebugRoutes(g *echo.Group) {
diff --git a/server/deploy_test.go b/server/deploy_test.go
index 4a7439edf0..ea201ed78a 100644
--- a/server/deploy_test.go
+++ b/server/deploy_test.go
@@ -3,8 +3,9 @@ package server
import (
"testing"
- "github.com/bytebase/bytebase/api"
"github.com/stretchr/testify/assert"
+
+ "github.com/bytebase/bytebase/api"
)
func TestGetDatabaseMatrixFromDeploymentSchedule(t *testing.T) {
diff --git a/server/issue_test.go b/server/issue_test.go
index 2cca105136..408be9126f 100644
--- a/server/issue_test.go
+++ b/server/issue_test.go
@@ -3,10 +3,11 @@ package server
import (
"testing"
- "github.com/bytebase/bytebase/api"
- "github.com/bytebase/bytebase/plugin/db"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/api"
+ "github.com/bytebase/bytebase/plugin/db"
)
func TestGetPeerTenantDatabase(t *testing.T) {
diff --git a/server/metric_reporter.go b/server/metric_reporter.go
index 75f0e2572b..6629251ad7 100644
--- a/server/metric_reporter.go
+++ b/server/metric_reporter.go
@@ -6,13 +6,14 @@ import (
"sync"
"time"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common/log"
enterpriseAPI "github.com/bytebase/bytebase/enterprise/api"
"github.com/bytebase/bytebase/plugin/metric"
"github.com/bytebase/bytebase/plugin/metric/segment"
"github.com/bytebase/bytebase/store"
- "github.com/pkg/errors"
"go.uber.org/zap"
)
diff --git a/server/openapi.go b/server/openapi.go
index 32072f3257..741b47c5b9 100644
--- a/server/openapi.go
+++ b/server/openapi.go
@@ -7,13 +7,14 @@ import (
"io"
"net/http"
+ "github.com/labstack/echo/v4"
+
"github.com/bytebase/bytebase/api"
metricAPI "github.com/bytebase/bytebase/metric"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
advisorDB "github.com/bytebase/bytebase/plugin/advisor/db"
"github.com/bytebase/bytebase/plugin/metric"
"github.com/bytebase/bytebase/store"
- "github.com/labstack/echo/v4"
)
var (
diff --git a/server/openapi_metric.go b/server/openapi_metric.go
index 90a98243eb..1e01c04605 100644
--- a/server/openapi_metric.go
+++ b/server/openapi_metric.go
@@ -4,9 +4,10 @@ import (
"strconv"
"time"
+ "github.com/labstack/echo/v4"
+
metricAPI "github.com/bytebase/bytebase/metric"
"github.com/bytebase/bytebase/plugin/metric"
- "github.com/labstack/echo/v4"
)
func openAPIMetricMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
diff --git a/server/pipeline.go b/server/pipeline.go
index 1819e4efec..e89eb49cc8 100644
--- a/server/pipeline.go
+++ b/server/pipeline.go
@@ -3,8 +3,9 @@ package server
import (
"context"
- "github.com/bytebase/bytebase/api"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/api"
)
// ScheduleActiveStage tries to schedule the tasks in the active stage.
diff --git a/server/recover.go b/server/recover.go
index f08a34deee..ec4539babe 100644
--- a/server/recover.go
+++ b/server/recover.go
@@ -1,10 +1,11 @@
package server
import (
- "github.com/bytebase/bytebase/common/log"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
"go.uber.org/zap"
+
+ "github.com/bytebase/bytebase/common/log"
)
func recoverMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
diff --git a/server/schema_syncer.go b/server/schema_syncer.go
index ade7840065..40daedb49b 100644
--- a/server/schema_syncer.go
+++ b/server/schema_syncer.go
@@ -6,10 +6,11 @@ import (
"sync"
"time"
- "github.com/bytebase/bytebase/api"
- "github.com/bytebase/bytebase/common/log"
"github.com/pkg/errors"
"go.uber.org/zap"
+
+ "github.com/bytebase/bytebase/api"
+ "github.com/bytebase/bytebase/common/log"
)
const (
diff --git a/server/server_frontend_not_embed.go b/server/server_frontend_not_embed.go
index 897b8ec286..479e454510 100644
--- a/server/server_frontend_not_embed.go
+++ b/server/server_frontend_not_embed.go
@@ -6,8 +6,9 @@ package server
import (
"net/http"
- "github.com/bytebase/bytebase/common/log"
"github.com/labstack/echo/v4"
+
+ "github.com/bytebase/bytebase/common/log"
)
func embedFrontend(e *echo.Echo) {
diff --git a/server/task_check_executor_statement_type.go b/server/task_check_executor_statement_type.go
index 823328e869..9236708cdd 100644
--- a/server/task_check_executor_statement_type.go
+++ b/server/task_check_executor_statement_type.go
@@ -5,14 +5,15 @@ import (
"encoding/json"
"fmt"
+ tidbparser "github.com/pingcap/tidb/parser"
+ tidbast "github.com/pingcap/tidb/parser/ast"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/parser"
"github.com/bytebase/bytebase/plugin/parser/ast"
- tidbparser "github.com/pingcap/tidb/parser"
- tidbast "github.com/pingcap/tidb/parser/ast"
)
// NewTaskCheckStatementTypeExecutor creates a task check DML executor.
diff --git a/server/task_check_scheduler.go b/server/task_check_scheduler.go
index bef97008af..728c03020c 100644
--- a/server/task_check_scheduler.go
+++ b/server/task_check_scheduler.go
@@ -7,12 +7,13 @@ import (
"sync"
"time"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// NewTaskCheckScheduler creates a task check scheduler.
diff --git a/server/task_executor.go b/server/task_executor.go
index 3d85484e24..088868d545 100644
--- a/server/task_executor.go
+++ b/server/task_executor.go
@@ -10,12 +10,13 @@ import (
"go.uber.org/zap"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
vcsPlugin "github.com/bytebase/bytebase/plugin/vcs"
- "github.com/pkg/errors"
)
// TaskExecutor is the task executor.
diff --git a/server/task_executor_data_update.go b/server/task_executor_data_update.go
index 719ad33042..4e4e4995db 100644
--- a/server/task_executor_data_update.go
+++ b/server/task_executor_data_update.go
@@ -5,9 +5,10 @@ import (
"encoding/json"
"sync/atomic"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
)
// NewDataUpdateTaskExecutor creates a data update (DML) task executor.
diff --git a/server/task_executor_database_backup.go b/server/task_executor_database_backup.go
index 23e3e831e8..c6ae7ca911 100644
--- a/server/task_executor_database_backup.go
+++ b/server/task_executor_database_backup.go
@@ -8,11 +8,12 @@ import (
"path/filepath"
"sync/atomic"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// NewDatabaseBackupTaskExecutor creates a new database backup task executor.
diff --git a/server/task_executor_database_create.go b/server/task_executor_database_create.go
index 1e2d84905d..02fe8e28e8 100644
--- a/server/task_executor_database_create.go
+++ b/server/task_executor_database_create.go
@@ -8,11 +8,12 @@ import (
"strings"
"sync/atomic"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// NewDatabaseCreateTaskExecutor creates a database create task executor.
diff --git a/server/task_executor_database_restore.go b/server/task_executor_database_restore.go
index 260d87ed7b..075fe2a27b 100644
--- a/server/task_executor_database_restore.go
+++ b/server/task_executor_database_restore.go
@@ -9,11 +9,12 @@ import (
"strconv"
"sync/atomic"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
"go.uber.org/zap"
)
diff --git a/server/task_executor_default.go b/server/task_executor_default.go
index a1c6aecf76..f2af6ef01d 100644
--- a/server/task_executor_default.go
+++ b/server/task_executor_default.go
@@ -5,9 +5,10 @@ import (
"fmt"
"sync/atomic"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common/log"
- "go.uber.org/zap"
)
// NewDefaultTaskExecutor creates a default task executor.
diff --git a/server/task_executor_pitr_cutover.go b/server/task_executor_pitr_cutover.go
index d1f0779063..471c2bca82 100644
--- a/server/task_executor_pitr_cutover.go
+++ b/server/task_executor_pitr_cutover.go
@@ -9,14 +9,15 @@ import (
"sync/atomic"
"time"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/db/mysql"
"github.com/bytebase/bytebase/plugin/db/util"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// NewPITRCutoverTaskExecutor creates a PITR cutover task executor.
diff --git a/server/task_executor_pitr_restore.go b/server/task_executor_pitr_restore.go
index 8280b5b663..b9f20af552 100644
--- a/server/task_executor_pitr_restore.go
+++ b/server/task_executor_pitr_restore.go
@@ -9,6 +9,9 @@ import (
"sync/atomic"
"time"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
@@ -17,8 +20,6 @@ import (
"github.com/bytebase/bytebase/plugin/db/pg"
"github.com/bytebase/bytebase/plugin/db/util"
"github.com/bytebase/bytebase/store"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// NewPITRRestoreTaskExecutor creates a PITR restore task executor.
diff --git a/server/task_executor_schema_update.go b/server/task_executor_schema_update.go
index 2aa21e7eab..c18694f4b7 100644
--- a/server/task_executor_schema_update.go
+++ b/server/task_executor_schema_update.go
@@ -5,8 +5,9 @@ import (
"encoding/json"
"sync/atomic"
- "github.com/bytebase/bytebase/api"
"github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/api"
)
// NewSchemaUpdateTaskExecutor creates a schema update (DDL) task executor.
diff --git a/server/task_scheduler.go b/server/task_scheduler.go
index 9b3ed58905..d16ce5bed5 100644
--- a/server/task_scheduler.go
+++ b/server/task_scheduler.go
@@ -8,11 +8,12 @@ import (
"sync"
"time"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
"go.uber.org/zap"
)
diff --git a/server/task_test.go b/server/task_test.go
index faac806717..3eca43ff1a 100644
--- a/server/task_test.go
+++ b/server/task_test.go
@@ -3,8 +3,9 @@ package server
import (
"testing"
- "github.com/bytebase/bytebase/api"
"github.com/stretchr/testify/assert"
+
+ "github.com/bytebase/bytebase/api"
)
func TestAreAllTasksDone(t *testing.T) {
diff --git a/sql-server/advise.go b/sql-server/advise.go
index 31650742f1..7d39a8c614 100644
--- a/sql-server/advise.go
+++ b/sql-server/advise.go
@@ -9,12 +9,13 @@ import (
metricAPI "github.com/bytebase/bytebase/metric"
+ "github.com/labstack/echo/v4"
+ "gopkg.in/yaml.v3"
+
"github.com/bytebase/bytebase/plugin/advisor"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
advisorDB "github.com/bytebase/bytebase/plugin/advisor/db"
"github.com/bytebase/bytebase/plugin/metric"
- "github.com/labstack/echo/v4"
- "gopkg.in/yaml.v3"
)
var (
diff --git a/sql-server/metric.go b/sql-server/metric.go
index b53d30ff64..b39743044c 100644
--- a/sql-server/metric.go
+++ b/sql-server/metric.go
@@ -4,11 +4,12 @@ import (
"strconv"
"time"
+ "github.com/labstack/echo/v4"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common/log"
metricAPI "github.com/bytebase/bytebase/metric"
"github.com/bytebase/bytebase/plugin/metric"
- "github.com/labstack/echo/v4"
- "go.uber.org/zap"
)
type metricReporter struct {
diff --git a/sql-server/server.go b/sql-server/server.go
index d68f63972d..5d081a8b69 100644
--- a/sql-server/server.go
+++ b/sql-server/server.go
@@ -7,16 +7,18 @@ import (
"net/http"
"time"
+ echoSwagger "github.com/swaggo/echo-swagger"
+
_ "github.com/bytebase/bytebase/docs/sqlservice" // initial the swagger doc
"github.com/bytebase/bytebase/plugin/metric/segment"
- echoSwagger "github.com/swaggo/echo-swagger"
- "github.com/bytebase/bytebase/common"
- "github.com/bytebase/bytebase/common/log"
"github.com/labstack/echo-contrib/pprof"
"github.com/labstack/echo-contrib/prometheus"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
+
+ "github.com/bytebase/bytebase/common"
+ "github.com/bytebase/bytebase/common/log"
)
// Server is the Bytebase server.
diff --git a/store/activity.go b/store/activity.go
index df7ccda598..d8e8106099 100644
--- a/store/activity.go
+++ b/store/activity.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// activityRaw is the store model for an Activity.
diff --git a/store/anomaly.go b/store/anomaly.go
index 0f8070a02f..e79bfc7600 100644
--- a/store/anomaly.go
+++ b/store/anomaly.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// anomalyRaw is the store model for an Anomaly.
diff --git a/store/backup.go b/store/backup.go
index 909d3a748d..71ce5fc092 100644
--- a/store/backup.go
+++ b/store/backup.go
@@ -7,9 +7,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// backupRaw is the store model for an Backup.
diff --git a/store/bookmark.go b/store/bookmark.go
index 9c7d0bc365..fe86743d92 100644
--- a/store/bookmark.go
+++ b/store/bookmark.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// bookmarkRaw is the store model for an Bookmark.
diff --git a/store/catalog.go b/store/catalog.go
index b7279fc0bd..f206dbcc1f 100644
--- a/store/catalog.go
+++ b/store/catalog.go
@@ -5,11 +5,12 @@ import (
"sort"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
advisorDB "github.com/bytebase/bytebase/plugin/advisor/db"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
)
var (
diff --git a/store/catalog_test.go b/store/catalog_test.go
index 094bbe58f0..7dd0df7b6b 100644
--- a/store/catalog_test.go
+++ b/store/catalog_test.go
@@ -3,9 +3,10 @@ package store
import (
"testing"
+ "github.com/stretchr/testify/assert"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/advisor/catalog"
- "github.com/stretchr/testify/assert"
)
func TestConvertIndexList(t *testing.T) {
diff --git a/store/column_test.go b/store/column_test.go
index 2045bf7d17..f77580d8d8 100644
--- a/store/column_test.go
+++ b/store/column_test.go
@@ -3,9 +3,10 @@ package store
import (
"testing"
+ "github.com/stretchr/testify/require"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/stretchr/testify/require"
)
func TestGenerateColumnActions(t *testing.T) {
diff --git a/store/data_source.go b/store/data_source.go
index d58e84cd3b..3a827f1d1b 100644
--- a/store/data_source.go
+++ b/store/data_source.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// dataSourceRaw is the store model for an DataSource.
diff --git a/store/database.go b/store/database.go
index e44ce26237..c172f091c7 100644
--- a/store/database.go
+++ b/store/database.go
@@ -8,10 +8,11 @@ import (
"math/rand"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/metric"
- "github.com/pkg/errors"
)
// databaseRaw is the store model for an Database.
diff --git a/store/deploy.go b/store/deploy.go
index f757f55bd1..a80d4d4b71 100644
--- a/store/deploy.go
+++ b/store/deploy.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// deploymentConfigRaw is the store model for an DeploymentConfig.
diff --git a/store/environment.go b/store/environment.go
index f294edd030..5993da5e02 100644
--- a/store/environment.go
+++ b/store/environment.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// environmentRaw is the store model for an Environment.
diff --git a/store/extension.go b/store/extension.go
index 21aec98071..2fb1b49e99 100644
--- a/store/extension.go
+++ b/store/extension.go
@@ -6,10 +6,11 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
)
// dbExtensionRaw is the store model for an DBExtension.
diff --git a/store/extension_test.go b/store/extension_test.go
index 5bb195087c..f2b0029919 100644
--- a/store/extension_test.go
+++ b/store/extension_test.go
@@ -3,9 +3,10 @@ package store
import (
"testing"
+ "github.com/stretchr/testify/require"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/stretchr/testify/require"
)
func TestGenerateDBExtensionActions(t *testing.T) {
diff --git a/store/inbox.go b/store/inbox.go
index 09c286178d..fa28866685 100644
--- a/store/inbox.go
+++ b/store/inbox.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// inboxRaw is the store model for an Inbox.
diff --git a/store/instance.go b/store/instance.go
index 3130234ebd..61f6497a83 100644
--- a/store/instance.go
+++ b/store/instance.go
@@ -6,11 +6,12 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/metric"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
)
// instanceRaw is the store model for an Instance.
diff --git a/store/instance_user.go b/store/instance_user.go
index dd70fba0cc..1f14baaaa3 100644
--- a/store/instance_user.go
+++ b/store/instance_user.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// UpsertInstanceUser would update the existing user if name matches.
diff --git a/store/issue.go b/store/issue.go
index 91a5a7313a..c0537329e1 100644
--- a/store/issue.go
+++ b/store/issue.go
@@ -9,10 +9,11 @@ import (
"strings"
"time"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/metric"
- "github.com/pkg/errors"
)
// issueRaw is the store model for an Issue.
diff --git a/store/issue_subscriber.go b/store/issue_subscriber.go
index ecae706dae..4d10eef896 100644
--- a/store/issue_subscriber.go
+++ b/store/issue_subscriber.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// issueSubscriberRaw is the store model for an IssueSubscriber.
diff --git a/store/label.go b/store/label.go
index 7558775453..03e4089fe6 100644
--- a/store/label.go
+++ b/store/label.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// labelKeyRaw is the store model for an LabelKey.
diff --git a/store/member.go b/store/member.go
index 872accbcac..7422deba4a 100644
--- a/store/member.go
+++ b/store/member.go
@@ -6,10 +6,11 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/metric"
- "github.com/pkg/errors"
)
// memberRaw is the store model for an Member.
diff --git a/store/metadb.go b/store/metadb.go
index bff16e7f08..312ddf8238 100644
--- a/store/metadb.go
+++ b/store/metadb.go
@@ -6,12 +6,13 @@ import (
"net/url"
"os"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
dbdriver "github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/resources/postgres"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// MetadataDB abstracts the underlying Postgres instance.
diff --git a/store/pg_engine.go b/store/pg_engine.go
index 6adedbca89..912014a458 100644
--- a/store/pg_engine.go
+++ b/store/pg_engine.go
@@ -13,9 +13,10 @@ import (
"time"
"github.com/blang/semver/v4"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/common/log"
dbdriver "github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
// Register postgres driver.
_ "github.com/bytebase/bytebase/plugin/db/pg"
diff --git a/store/pg_engine_test.go b/store/pg_engine_test.go
index 39c5d15a94..13238b98c1 100644
--- a/store/pg_engine_test.go
+++ b/store/pg_engine_test.go
@@ -8,12 +8,13 @@ import (
"testing"
"github.com/blang/semver/v4"
+ "github.com/stretchr/testify/require"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
dbdriver "github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/resources/postgres"
- "github.com/stretchr/testify/require"
- "go.uber.org/zap"
)
func TestGetMinorMigrationVersions(t *testing.T) {
diff --git a/store/pipeline.go b/store/pipeline.go
index e1deef6473..45ec4388bd 100644
--- a/store/pipeline.go
+++ b/store/pipeline.go
@@ -6,11 +6,12 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// pipelineRaw is the store model for an Pipeline.
diff --git a/store/policy.go b/store/policy.go
index 5b78669ad3..4a9782f9b3 100644
--- a/store/policy.go
+++ b/store/policy.go
@@ -6,10 +6,11 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/advisor"
- "github.com/pkg/errors"
)
// policyRaw is the store model for an Policy.
diff --git a/store/principal.go b/store/principal.go
index 3c9d902ee1..bd50f19d8e 100644
--- a/store/principal.go
+++ b/store/principal.go
@@ -6,11 +6,12 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// principalRaw is the store model for a Principal.
diff --git a/store/project_member.go b/store/project_member.go
index 05fa7dad5f..87e83d1635 100644
--- a/store/project_member.go
+++ b/store/project_member.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// projectMemberRaw is the store model for an ProjectMember.
diff --git a/store/setting.go b/store/setting.go
index cb5a274be3..a3cbea8699 100644
--- a/store/setting.go
+++ b/store/setting.go
@@ -5,9 +5,10 @@ import (
"database/sql"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// settingRaw is the store model for an Setting.
diff --git a/store/sheet.go b/store/sheet.go
index 1f0df7a2f2..b260156c13 100644
--- a/store/sheet.go
+++ b/store/sheet.go
@@ -6,10 +6,11 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/metric"
- "github.com/pkg/errors"
)
// sheetRaw is the store model for an Sheet.
diff --git a/store/sheet_organizer.go b/store/sheet_organizer.go
index 0b65663e7b..d698b5675b 100644
--- a/store/sheet_organizer.go
+++ b/store/sheet_organizer.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// sheetOrganizerRaw is the store model for SheetOrganizer.
diff --git a/store/stage.go b/store/stage.go
index 750083c9f7..af87485b8a 100644
--- a/store/stage.go
+++ b/store/stage.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// stageRaw is the store model for an Stage.
diff --git a/store/table.go b/store/table.go
index e2d5a565c2..293d958bad 100644
--- a/store/table.go
+++ b/store/table.go
@@ -6,11 +6,12 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
)
// tableRaw is the store model for an Table.
diff --git a/store/table_index_test.go b/store/table_index_test.go
index 1ae55b7308..69a44ac98b 100644
--- a/store/table_index_test.go
+++ b/store/table_index_test.go
@@ -3,9 +3,10 @@ package store
import (
"testing"
+ "github.com/stretchr/testify/require"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/stretchr/testify/require"
)
func TestGenerateIndexActions(t *testing.T) {
diff --git a/store/task.go b/store/task.go
index 5f7f934eba..19b85156ed 100644
--- a/store/task.go
+++ b/store/task.go
@@ -8,12 +8,13 @@ import (
"strings"
"time"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/metric"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// taskRaw is the store model for an Task.
diff --git a/store/task_check_run.go b/store/task_check_run.go
index 34d1d2dbd5..801fefb63b 100644
--- a/store/task_check_run.go
+++ b/store/task_check_run.go
@@ -6,11 +6,12 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
- "github.com/pkg/errors"
- "go.uber.org/zap"
)
// taskCheckRunRaw is the store model for a TaskCheckRun.
diff --git a/store/task_dag.go b/store/task_dag.go
index 6c166911f4..87568fbaa1 100644
--- a/store/task_dag.go
+++ b/store/task_dag.go
@@ -4,9 +4,10 @@ import (
"context"
"database/sql"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
type taskDAGRaw struct {
diff --git a/store/task_run.go b/store/task_run.go
index d419ba5ac0..02f9de53b9 100644
--- a/store/task_run.go
+++ b/store/task_run.go
@@ -6,9 +6,10 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
- "github.com/pkg/errors"
)
// taskRunRaw is the store model for an TaskRun.
diff --git a/store/vcs.go b/store/vcs.go
index a5160f25fb..1df402e8e6 100644
--- a/store/vcs.go
+++ b/store/vcs.go
@@ -6,10 +6,11 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/vcs"
- "github.com/pkg/errors"
)
// vcsRaw is the store model for a VCS (Version Control System).
diff --git a/store/view.go b/store/view.go
index 5d92d6aed3..153eb04d3d 100644
--- a/store/view.go
+++ b/store/view.go
@@ -6,10 +6,11 @@ import (
"fmt"
"strings"
+ "github.com/pkg/errors"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/pkg/errors"
)
// viewRaw is the store model for an View.
diff --git a/store/view_test.go b/store/view_test.go
index 6de2d790a6..9dbb4c57aa 100644
--- a/store/view_test.go
+++ b/store/view_test.go
@@ -3,9 +3,10 @@ package store
import (
"testing"
+ "github.com/stretchr/testify/require"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/plugin/db"
- "github.com/stretchr/testify/require"
)
func TestGenerateViewActions(t *testing.T) {
diff --git a/tests/external_pg_test.go b/tests/external_pg_test.go
index 8d13158a6b..40ed89ff77 100644
--- a/tests/external_pg_test.go
+++ b/tests/external_pg_test.go
@@ -7,12 +7,13 @@ import (
"path"
"testing"
+ "github.com/pkg/errors"
+ "go.uber.org/zap"
+
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/resources/postgres"
"github.com/bytebase/bytebase/tests/fake"
- "github.com/pkg/errors"
- "go.uber.org/zap"
"github.com/stretchr/testify/require"
)
diff --git a/tests/mysql_prepare_test.go b/tests/mysql_prepare_test.go
index 4bd31d6621..7d636c0f03 100644
--- a/tests/mysql_prepare_test.go
+++ b/tests/mysql_prepare_test.go
@@ -6,8 +6,9 @@ package tests
import (
"testing"
- "github.com/bytebase/bytebase/resources/mysql"
"github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/resources/mysql"
)
func TestPrepare(t *testing.T) {
diff --git a/tests/mysql_test.go b/tests/mysql_test.go
index 6854b10bb0..902c003ace 100644
--- a/tests/mysql_test.go
+++ b/tests/mysql_test.go
@@ -10,12 +10,13 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/require"
+ "go.uber.org/zap/zapcore"
+
"github.com/bytebase/bytebase/common/log"
pluginmysql "github.com/bytebase/bytebase/plugin/db/mysql"
resourcemysql "github.com/bytebase/bytebase/resources/mysql"
"github.com/bytebase/bytebase/resources/mysqlutil"
- "github.com/stretchr/testify/require"
- "go.uber.org/zap/zapcore"
)
func TestCheckEngineInnoDB(t *testing.T) {
diff --git a/tests/project_test.go b/tests/project_test.go
index be3375b0ef..8766241b2f 100644
--- a/tests/project_test.go
+++ b/tests/project_test.go
@@ -7,13 +7,14 @@ import (
"strconv"
"testing"
+ "github.com/stretchr/testify/require"
+ "go.uber.org/zap/zapcore"
+
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common/log"
"github.com/bytebase/bytebase/plugin/db"
resourcemysql "github.com/bytebase/bytebase/resources/mysql"
"github.com/bytebase/bytebase/tests/fake"
- "github.com/stretchr/testify/require"
- "go.uber.org/zap/zapcore"
)
func TestArchiveProject(t *testing.T) {