mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 03:27:48 +00:00
reflect: print struct tags in Type.String() (with a caveat)
This commit is contained in:
@@ -551,6 +551,13 @@ func (t *rawType) String() string {
|
||||
for i := 0; i < numField; i++ {
|
||||
f := t.rawField(i)
|
||||
s += " " + f.Name + " " + f.Type.String()
|
||||
if f.Tag != "" {
|
||||
// TODO(dgryski): The tag should be
|
||||
// double-quoted and escaped; that requires
|
||||
// strconv and reflectlite or our own Quote()
|
||||
// implementation
|
||||
s += " " + string(f.Tag)
|
||||
}
|
||||
// every field except the last needs a semicolon
|
||||
if i < numField-1 {
|
||||
s += ";"
|
||||
|
||||
Reference in New Issue
Block a user