8000 Validate XML chardata field types by dajiaohuang · Pull Request #1789 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

Validate XML chardata field types - #1789

Closed
dajiaohuang wants to merge 3 commits into
dominikh:masterfrom
dajiaohuang:fix/fakexml-cdata-types
Closed

dajiaohuang wants to merge 3 commits into
dominikh:masterfrom
dajiaohuang:fix/fakexml-cdata-types

Conversation

@dajiaohuang
@dajiaohuang dajiaohuang commented Oct 1, 2026 •
Copy link
Copy Markdown

The fake XML marshaler stops processing ,chardata and ,cdata fields after checking TextMarshaler, so unsupported channel/function fields are missed. Let fields without a marshaler continue through the normal XML type validation and add SA1026 fixtures.

Review update: the unrelated generic-instantiation change and its fixture were removed through a normal follow-up commit; #1764 tracks that fix separately. Current-head validation: go test ./staticcheck/sa1026 passed (three tests); git diff --check passed. Prior validation text above is historical unless repeated here.

@dajiaohuang
Copy link
Copy Markdown
Author

Withdrawing because the proposed diagnostics do not match encoding/xml. In Go 1.27.0, marshalStruct handles chardata/cdata in its own kind switch and then continues; channel/function fields fall through without returning UnsupportedTypeError. A direct xml.Marshal check with a non-nil channel chardata field and a non-nil function cdata field returns and , respectively, with nil errors. Removing this continue would introduce false-positive SA1026 diagnostics rather than repair the claimed runtime failure.

@dajiaohuang dajiaohuang closed this Oct 8, 2026
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

0