cl: remove Underlying() call to reject string type aliases in rewrites

Type aliases like `type T string` are no longer supported for
-ldflags -X rewrites. Only direct *string types are now allowed.

- Removed Underlying() call from isStringPtrType
- Added TestRewriteIgnoresStringAlias test case

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
This commit is contained in:
xgopilot
2025-11-14 14:49:30 +00:00
parent 1ba7d1e561
commit 034b05c53c
2 changed files with 15 additions and 1 deletions

View File

@@ -151,7 +151,7 @@ func (p *context) isStringPtrType(typ types.Type) bool {
if !ok {
return false
}
basic, ok := ptr.Elem().Underlying().(*types.Basic)
basic, ok := ptr.Elem().(*types.Basic)
return ok && basic.Kind() == types.String
}