MCPcopy
hub / github.com/kubepug/kubepug / extractTag

Function extractTag

generator/deprecations/gen.go:157–178  ·  view source on GitHub ↗
(tagName string, comments []string)

Source from the content-addressed store, hash-verified

155}
156
157func 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.
181func NameSystems() namer.NameSystems {

Callers 4

extractEnabledTypeTagFunction · 0.85
tagExistsFunction · 0.85
extractKubeVersionTagFunction · 0.85
PackagesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected