Skip to content

stream: move to x/stream; domaintext literal: xgo/tpl/encoding => xgo/encoding#2622

Merged
xushiwei merged 6 commits intogoplus:mainfrom
xushiwei:q
Feb 15, 2026
Merged

stream: move to x/stream; domaintext literal: xgo/tpl/encoding => xgo/encoding#2622
xushiwei merged 6 commits intogoplus:mainfrom
xushiwei:q

Conversation

@xushiwei
Copy link
Member

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @xushiwei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a significant refactoring effort, primarily by externalizing the stream package to a shared library and reorganizing internal encoding packages for a cleaner project structure. It also introduces a more modular approach to XML parsing and enhances the usability of DQL NodeSet methods by providing both error-handling and convenience versions. These changes aim to improve maintainability, reduce redundancy, and streamline code usage within the project.

Highlights

  • Stream Package Relocation: The internal dql/stream package and its sub-packages have been removed and replaced by an external dependency on github.com/qiniu/x/stream.
  • Encoding Package Path Update: The tpl/encoding packages (csv, json, regexp, regexposix, xml) have been moved to a new root-level encoding directory, updating their import paths accordingly.
  • XML Parsing Refactoring: XML parsing logic has been refactored, with the core Node structure and Parse function moved into a new dql/xml/parse.go file.
  • Method Signature Enhancement for DQL NodeSets: Methods like Value, XGo_Attr, and Text in dql/html/html.go and dql/xml/xml.go have been updated to provide both error-returning (__1 suffix) and non-error-returning (__0 suffix) versions for improved flexibility.
  • Simplified Variable Assignment: Go code in dql queries has been updated to simplify variable assignment by removing the blank identifier _ when only one return value is needed.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • cl/_testgop/domaintext-html/go.mod
    • Removed module file.
  • cl/_testgop/domaintext-html/go.sum
    • Removed sum file.
  • cl/_testgop/domaintext-json/out.go
    • Updated import path for the json encoding package.
  • cl/_testgop/domaintext-regexp/out.go
    • Updated import path for the regexp encoding package.
  • cl/expr.go
    • Added encodingPkgPrefix constant.
    • Updated domain text literal compilation to use the new encoding package path.
  • demo/dql-links/links.xgo
    • Simplified variable assignment for a.$href.
  • dql/fetcher/hrefs/hrefs.xgo
    • Simplified variable assignment for a.$href.
  • dql/html/html.go
    • Updated stream import to github.com/qiniu/x/stream.
    • Refactored Value, XGo_Attr, and Text methods to include __0 (non-error) and __1 (error) versions.
    • Updated Int method to call the error-returning Text__1.
  • dql/json/json.go
    • Updated stream import to github.com/qiniu/x/stream.
  • dql/stream/http/cached/cached.go
    • Removed file.
  • dql/stream/http/httpstrm.go
    • Removed file.
  • dql/stream/http/nocache/nocache.go
    • Removed file.
  • dql/stream/inline/inline.go
    • Removed file.
  • dql/stream/stream.go
    • Removed file.
  • dql/stream/stream_test.go
    • Removed file.
  • dql/stream/zip/zipstrm.go
    • Removed file.
  • dql/xml/parse.go
    • Added new file containing Node struct, Parse function, UnmarshalXML implementation, and XGo_Elem, XGo_Child, XGo_Any methods for XML parsing.
  • dql/xml/xml.go
    • Updated stream import to github.com/qiniu/x/stream.
    • Removed Node struct and UnmarshalXML method, which were moved to dql/xml/parse.go.
    • Updated New function to use Parse from dql/xml/parse.go.
    • Refactored XGo_Attr and XGo_text methods to include __0 (non-error) and __1 (error) versions.
    • Updated XGo_int method to call the error-returning XGo_text__1.
  • go.mod
    • Updated github.com/qiniu/x dependency from v1.16.0 to v1.16.1.
  • go.sum
    • Updated checksum for github.com/qiniu/x v1.16.1.
  • tpl/encoding/csv/csv.go
    • Renamed file to encoding/csv/csv.go.
  • tpl/encoding/json/json.go
    • Renamed file to encoding/json/json.go.
  • tpl/encoding/regexp/regexp.go
    • Renamed file to encoding/regexp/regexp.go.
  • tpl/encoding/regexposix/regexp.go
    • Renamed file to encoding/regexposix/regexp.go.
  • tpl/encoding/xml/xml.go
    • Renamed file to encoding/xml/xml.go.
    • Updated New function to use dql/xml.Parse.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.11%. Comparing base (382e1a8) to head (47dad0a).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2622   +/-   ##
=======================================
  Coverage   94.11%   94.11%           
=======================================
  Files          32       32           
  Lines        9956     9956           
=======================================
  Hits         9370     9370           
  Misses        418      418           
  Partials      168      168           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily refactors the "stream" and "tpl/encoding" packages and improves DQL packages for error handling and organization. However, the new custom XML parsing logic in "dql/xml/parse.go" introduces critical security vulnerabilities. The recursive "UnmarshalXML" is vulnerable to Denial of Service (DoS) via stack overflow with deeply nested XML. Furthermore, the implementation incorrectly handles the lifetime of "xml.Decoder" slices for "CharData" tokens, leading to data corruption due to buffer reuse. These issues must be addressed.

@xushiwei xushiwei merged commit 3c094bf into goplus:main Feb 15, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments