newScannerFromString creates a bufio.Scanner backed by the given string. The input must be a complete line terminated by a newline; if it is not (and is non-empty), a trailing newline is appended automatically so that bufio.Scanner.Scan() sees a complete line rather than returning false at EOF.
(s string)
| 991 | // (and is non-empty), a trailing newline is appended automatically so that |
| 992 | // bufio.Scanner.Scan() sees a complete line rather than returning false at EOF. |
| 993 | func newScannerFromString(s string) *bufio.Scanner { |
| 994 | if s != "" && !strings.HasSuffix(s, "\n") { |
| 995 | s += "\n" |
| 996 | } |
| 997 | return bufio.NewScanner(strings.NewReader(s)) |
| 998 | } |
no outgoing calls
no test coverage detected