Skip to content

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

fix: remove unnecessary []byte conversion (#7902)

p0nyf9e123b32475
diff --git a/.golangci.yaml b/.golangci.yaml
index c821375f74..bb913f3958 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -15,6 +15,7 @@ linters:
- nilerr
- godot
- forbidigo
+ - mirror
# golangci-lint run --exclude="Rollback,logger.Sync,pgInstance.Stop"
issues:
diff --git a/backend/plugin/parser/sql/transform/mysql/transform.go b/backend/plugin/parser/sql/transform/mysql/transform.go
index 6b7edb825a..01f0d72d34 100644
--- a/backend/plugin/parser/sql/transform/mysql/transform.go
+++ b/backend/plugin/parser/sql/transform/mysql/transform.go
@@ -540,7 +540,7 @@ func deparse(newNodeList []ast.Node) (string, error) {
if err := node.Restore(format.NewRestoreCtx(format.DefaultRestoreFlags|format.RestoreStringWithoutCharset|format.RestorePrettyFormat, &buf)); err != nil {
return "", err
}
- if _, err := buf.Write([]byte(";\n\n")); err != nil {
+ if _, err := buf.WriteString(";\n\n"); err != nil {
return "", err
}
}
diff --git a/backend/plugin/parser/sql/utils.go b/backend/plugin/parser/sql/utils.go
index c41986043b..da1ffc8e22 100644
--- a/backend/plugin/parser/sql/utils.go
+++ b/backend/plugin/parser/sql/utils.go
@@ -672,8 +672,8 @@ func ExtractTiDBUnsupportStmts(stmts string) ([]string, string, error) {
unsupportStmts = append(unsupportStmts, content)
continue
}
- _, _ = supportedStmts.Write([]byte(content))
- _, _ = supportedStmts.Write([]byte("\n"))
+ _, _ = supportedStmts.WriteString(content)
+ _, _ = supportedStmts.WriteString("\n")
}
return unsupportStmts, supportedStmts.String(), nil
}
diff --git a/backend/server/issue.go b/backend/server/issue.go
index 446da0fc84..f007f59c42 100644
--- a/backend/server/issue.go
+++ b/backend/server/issue.go
@@ -1259,7 +1259,7 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.Con
// We don't want empty statements(likes comments) to be involved in the match/replace SchemaGroup operation. We will
// put them in the next valid statement.
if singleStatement.Empty {
- if _, err := emptyStatementsBuffer.Write([]byte(singleStatement.Text)); err != nil {
+ if _, err := emptyStatementsBuffer.WriteString(singleStatement.Text); err != nil {
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Cannot write to string builder")
}
continue