reflect: print struct tags in Type.String() (with a caveat)

Этот коммит содержится в:
Damian Gryski 2023-03-24 10:25:52 -07:00 коммит произвёл Ron Evans
родитель 1a60a1f526
коммит e7bd22edf2

Просмотреть файл

@ -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 += ";"