LocationString prints a human-readable description of the SourceRange.
()
| 30 | // LocationString prints a human-readable description of the |
| 31 | // SourceRange. |
| 32 | func (s SourceRange) LocationString() string { |
| 33 | switch { |
| 34 | case s.LastLine <= s.FirstLine: |
| 35 | return "<invalid SourceRange>" |
| 36 | case s.LastLine == s.FirstLine+1: |
| 37 | return fmt.Sprintf("line %d", s.FirstLine+1) |
| 38 | default: |
| 39 | return fmt.Sprintf("lines %d-%d", s.FirstLine+1, s.LastLine) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // merge returns a SourceRange that contains both s and other. If s |
| 44 | // and other are not contiguous or overlapping, the returned |