(which string, f reflect.StructField)
| 16 | var ErrSkip = errors.New("unpack skip tag can only appear once") |
| 17 | |
| 18 | func parseTag(which string, f reflect.StructField) (string, bool, []string) { |
| 19 | tag, ok := f.Tag.Lookup(which) |
| 20 | if !ok { |
| 21 | return "", false, nil |
| 22 | } |
| 23 | if tag == "" { |
| 24 | return "", true, nil |
| 25 | } |
| 26 | elems := strings.Split(tag, tagSep) |
| 27 | var opts []string |
| 28 | if len(elems) > 1 { |
| 29 | opts = elems[1:] |
| 30 | } |
| 31 | return elems[0], true, opts |
| 32 | } |
| 33 | |
| 34 | func jsonFieldName(f reflect.StructField) (string, bool) { |
| 35 | s, ok, _ := parseTag(tagJSON, f) |
no test coverage detected