diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 23b9b31b..27762597 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -19,6 +19,6 @@ jobs: go-version: 1.21.3 - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: latest diff --git a/internal/mysql/node.go b/internal/mysql/node.go index 84ae31b1..5edb5e3f 100644 --- a/internal/mysql/node.go +++ b/internal/mysql/node.go @@ -243,11 +243,11 @@ func (n *Node) exec(queryName string, arg map[string]interface{}) error { return n.execWithTimeout(queryName, arg, n.config.DBTimeout) } -func (n *Node) getRunningQueryIds(excludeUsers []string, timeout time.Duration) ([]int, error) { +func (n *Node) getRunningQueryIDs(excludeUsers []string, timeout time.Duration) ([]int, error) { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - query := DefaultQueries[queryGetProcessIds] + query := DefaultQueries[queryGetProcessIDs] bquery, args, err := sqlx.In(query, excludeUsers) if err != nil { @@ -663,7 +663,7 @@ func (n *Node) SetReadOnlyWithForce(excludeUsers []string, superReadOnly bool) e go func() { for { - ids, err := n.getRunningQueryIds(excludeUsers, time.Second) + ids, err := n.getRunningQueryIDs(excludeUsers, time.Second) if err == nil { for _, id := range ids { _ = n.exec(queryKillQuery, map[string]interface{}{"kill_id": strconv.Itoa(id)}) diff --git a/internal/mysql/queries.go b/internal/mysql/queries.go index f3aaa7c7..4e0288cd 100644 --- a/internal/mysql/queries.go +++ b/internal/mysql/queries.go @@ -30,7 +30,7 @@ const ( queryEnableEvent = "enable_event" querySetLockTimeout = "set_lock_timeout" queryKillQuery = "kill_query" - queryGetProcessIds = "get_process_ids" + queryGetProcessIDs = "get_process_ids" queryEnableOfflineMode = "enable_offline_mode" queryDisableOfflineMode = "disable_offline_mode" queryGetOfflineMode = "get_offline_mode" @@ -97,7 +97,7 @@ var DefaultQueries = map[string]string{ queryEnableEvent: `ALTER DEFINER = :user@:host EVENT :schema.:name ENABLE`, querySetLockTimeout: `SET SESSION lock_wait_timeout = ?`, queryKillQuery: `KILL :kill_id`, - queryGetProcessIds: `SELECT ID FROM information_schema.PROCESSLIST p WHERE USER NOT IN (?) AND COMMAND != 'Killed'`, + queryGetProcessIDs: `SELECT ID FROM information_schema.PROCESSLIST p WHERE USER NOT IN (?) AND COMMAND != 'Killed'`, queryEnableOfflineMode: `SET GLOBAL offline_mode = ON`, queryDisableOfflineMode: `SET GLOBAL offline_mode = OFF`, queryGetOfflineMode: `SELECT @@GLOBAL.offline_mode AS OfflineMode`,