(w io.Writer, tag string, m map[string]interface{})
| 193 | } |
| 194 | |
| 195 | func stdTagFunc(w io.Writer, tag string, m map[string]interface{}) (int, error) { |
| 196 | v := m[tag] |
| 197 | if v == nil { |
| 198 | return 0, nil |
| 199 | } |
| 200 | switch value := v.(type) { |
| 201 | case []byte: |
| 202 | return w.Write(value) |
| 203 | case string: |
| 204 | return w.Write([]byte(value)) |
| 205 | case TagFunc: |
| 206 | return value(w, tag) |
| 207 | default: |
| 208 | return 0, fmt.Errorf("tag=%q contains unexpected value type=%#v. Expected []byte, string or TagFunc", tag, v) |
| 209 | } |
| 210 | } |
no test coverage detected