MCPcopy Create free account
hub / github.com/dispatchrun/wazergo / formatStruct

Function formatStruct

types/format.go:119–135  ·  view source on GitHub ↗
(w io.Writer, v reflect.Value)

Source from the content-addressed store, hash-verified

117}
118
119func formatStruct(w io.Writer, v reflect.Value) {
120 io.WriteString(w, "{")
121 t := v.Type()
122 for i, f := range reflect.VisibleFields(t) {
123 if i != 0 {
124 io.WriteString(w, ",")
125 }
126 name := f.Tag.Get("name")
127 if name == "" {
128 name = f.Name
129 }
130 io.WriteString(w, name)
131 io.WriteString(w, ":")
132 format(w, v.FieldByIndex(f.Index))
133 }
134 io.WriteString(w, "}")
135}
136
137func formatPointer(w io.Writer, v reflect.Value) {
138 if v.IsNil() {

Callers 1

formatFunction · 0.85

Calls 2

formatFunction · 0.85
WriteStringMethod · 0.80

Tested by

no test coverage detected