MCPcopy Index your code
hub / github.com/maruel/panicparse / splitTag

Function splitTag

stack/html.go:214–231  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

212var reVersion = regexp.MustCompile(`v\d+\.\d+\.\d+\-\d+\-([a-f0-9]+)`)
213
214func splitTag(s string) (string, string, template.URL) {
215 // Default to branch master for non-versioned dependencies. It's not
216 // optimal but it's better than nothing?
217 // TODO(maruel): Replace with HEAD.
218 i := strings.IndexByte(s, '@')
219 if i == -1 {
220 // No tag was found.
221 return s, "master", "master"
222 }
223 // We got a versioned go module.
224 tag := s[i+1:]
225 srcTag := tag
226 if m := reVersion.FindStringSubmatch(tag); len(m) != 0 {
227 srcTag = m[1]
228 }
229 /* #nosec G203 */
230 return s[:i], url.QueryEscape(srcTag), template.URL(url.QueryEscape(tag))
231}
232
233// symbol is the hashtag to use to refer to the symbol when looking at
234// documentation.

Callers 1

getSrcBranchURLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…