func parseTags()

in gotype/tags.go [46:70]


func parseTags(tag string) (string, tagOptions) {
	s := strings.Split(tag, ",")
	if len(s) == 0 {
		return "", defaultTagOptions
	}

	if s[0] == "-" {
		opts := defaultTagOptions
		opts.omit = true
		return "", opts
	}

	opts := defaultTagOptions
	for _, opt := range s[1:] {
		switch strings.TrimSpace(opt) {
		case "squash", "inline":
			opts.squash = true
		case "omitempty":
			opts.omitEmpty = true
		case "omit":
			opts.omit = true
		}
	}
	return strings.TrimSpace(s[0]), opts
}