aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/reflect
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2023-03-24 10:25:52 -0700
committerRon Evans <[email protected]>2023-03-30 21:10:54 +0200
commite7bd22edf25b1c54058553a173a6d259dff6c09c (patch)
tree1b9b39e837264b67d903b3ec47b973534ee6c442 /src/reflect
parent1a60a1f52625412c8c18dc95a679dc90c0324772 (diff)
downloadtinygo-e7bd22edf25b1c54058553a173a6d259dff6c09c.tar.gz
tinygo-e7bd22edf25b1c54058553a173a6d259dff6c09c.zip
reflect: print struct tags in Type.String() (with a caveat)
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/type.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/reflect/type.go b/src/reflect/type.go
index e78be71f8..ca07a3268 100644
--- a/src/reflect/type.go
+++ b/src/reflect/type.go
@@ -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 += ";"