mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 21:43:40 +00:00
reflect: make sure null bytes are supported in tags
This commit is contained in:
committed by
Ron Evans
parent
012bdfae80
commit
ebb410afd9
Vendored
+4
-3
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@@ -17,8 +18,8 @@ type (
|
||||
Y int16
|
||||
}
|
||||
mystruct struct {
|
||||
n int `foo:"bar"`
|
||||
some point
|
||||
n int `foo:"bar"`
|
||||
some point "some\x00tag"
|
||||
zero struct{}
|
||||
buf []byte
|
||||
Buf []byte
|
||||
@@ -480,7 +481,7 @@ func showValue(rv reflect.Value, indent string) {
|
||||
for i := 0; i < rv.NumField(); i++ {
|
||||
field := rt.Field(i)
|
||||
println(indent+" field:", i, field.Name)
|
||||
println(indent+" tag:", field.Tag)
|
||||
println(indent+" tag:", strconv.Quote(string(field.Tag)))
|
||||
println(indent+" embedded:", field.Anonymous)
|
||||
println(indent+" exported:", field.IsExported())
|
||||
showValue(rv.Field(i), indent+" ")
|
||||
|
||||
Reference in New Issue
Block a user