(s string)
| 212 | var reVersion = regexp.MustCompile(`v\d+\.\d+\.\d+\-\d+\-([a-f0-9]+)`) |
| 213 | |
| 214 | func 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. |
no outgoing calls
no test coverage detected
searching dependent graphs…