MCPcopy Create free account
hub / github.com/github/gh-aw / newScannerFromString

Function newScannerFromString

pkg/cli/interactive_test.go:993–998  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
993func newScannerFromString(s string) *bufio.Scanner {
994 if s != "" && !strings.HasSuffix(s, "\n") {
995 s += "\n"
996 }
997 return bufio.NewScanner(strings.NewReader(s))
998}

Calls

no outgoing calls

Tested by

no test coverage detected