languageKey returns the lowercased file extension (with the leading dot) or " " for extensionless files.
(it model.ScanItem)
| 94 | // languageKey returns the lowercased file extension (with the leading dot) |
| 95 | // or "<no-ext>" for extensionless files. |
| 96 | func languageKey(it model.ScanItem) string { |
| 97 | base := it.Path |
| 98 | if i := strings.LastIndex(base, "/"); i >= 0 { |
| 99 | base = base[i+1:] |
| 100 | } |
| 101 | dot := strings.LastIndex(base, ".") |
| 102 | if dot <= 0 { |
| 103 | return "<no-ext>" |
| 104 | } |
| 105 | return strings.ToLower(base[dot:]) |
| 106 | } |
| 107 | |
| 108 | // firstLevelDirKey returns the first path segment of a repo-relative path, |
| 109 | // or "<root>" for files directly in the repo root. |
no outgoing calls