Function
computePadding
(s string, makers []string)
Source from the content-addressed store, hash-verified
| 16 | } |
| 17 | |
| 18 | func computePadding(s string, makers []string) int { |
| 19 | padding := 0 |
| 20 | |
| 21 | for _, m := range makers { |
| 22 | if strings.HasPrefix(s, m) { |
| 23 | l := utf8.RuneCountInString(m) |
| 24 | |
| 25 | padding = l |
| 26 | for i, r := range s { |
| 27 | if i < l { |
| 28 | continue |
| 29 | } |
| 30 | |
| 31 | if r == ' ' { |
| 32 | padding++ |
| 33 | } else { |
| 34 | break |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | return padding |
| 41 | } |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…