(maxWidth int, t string)
| 104 | } |
| 105 | |
| 106 | func truncateMiddle(maxWidth int, t string) string { |
| 107 | if len(t) <= maxWidth { |
| 108 | return t |
| 109 | } |
| 110 | |
| 111 | ellipsis := "..." |
| 112 | if maxWidth < len(ellipsis)+2 { |
| 113 | return t[0:maxWidth] |
| 114 | } |
| 115 | |
| 116 | halfWidth := (maxWidth - len(ellipsis)) / 2 |
| 117 | remainder := (maxWidth - len(ellipsis)) % 2 |
| 118 | return t[0:halfWidth+remainder] + ellipsis + t[len(t)-halfWidth:] |
| 119 | } |
| 120 | |
| 121 | func printError(w io.Writer, err error) { |
| 122 | fmt.Fprintln(w, "warning: ", err) |
nothing calls this directly
no outgoing calls
no test coverage detected