(tagName string, comments []string)
| 155 | } |
| 156 | |
| 157 | func extractTag(tagName string, comments []string) (*tagValue, error) { |
| 158 | tagVals := types.ExtractCommentTags("+", comments)[tagName] |
| 159 | if tagVals == nil { |
| 160 | // No match for the tag. |
| 161 | return nil, nil |
| 162 | } |
| 163 | // If there are multiple values, abort. |
| 164 | if len(tagVals) > 1 { |
| 165 | return nil, fmt.Errorf("found %d %s tags: %q", len(tagVals), tagName, tagVals) |
| 166 | } |
| 167 | |
| 168 | // If we got here we are returning something. |
| 169 | tag := &tagValue{} |
| 170 | |
| 171 | // Get the primary value. |
| 172 | parts := strings.Split(tagVals[0], ",") |
| 173 | if len(parts) >= 1 { |
| 174 | tag.value = parts[0] |
| 175 | } |
| 176 | |
| 177 | return tag, nil |
| 178 | } |
| 179 | |
| 180 | // NameSystems returns the name system used by the generators in this package. |
| 181 | func NameSystems() namer.NameSystems { |
no outgoing calls
no test coverage detected