~yerinalexey/rex

4cc8c39427de25ffe3cd8c1bcc8d6e44e5c61de1 — Alexey Yerin 5 months ago c875d95
Rename from{File,Stdin} to read{File,Stdin}
1 files changed, 4 insertions(+), 4 deletions(-)

M main.go
M main.go => main.go +4 -4
@@ 75,7 75,7 @@ func regexWorker(in chan string, tests string, out *tview.TextView) {
	}
}

func fromStdin() string {
func readStdin() string {
	var data string
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {


@@ 86,7 86,7 @@ func fromStdin() string {
	return data
}

func fromFile(fname string) (string, error) {
func readFile(fname string) (string, error) {
	// TODO: This will block before file loads, should be in a separate
	// goroutine
	raw, err := ioutil.ReadFile(fname)


@@ 120,10 120,10 @@ func main() {

	// Determine type of input
	if file == "" {
		data = fromStdin()
		data = readStdin()
	} else {
		var err error
		data, err = fromFile(file)
		data, err = readFile(file)

		if err != nil {
			fatalf("Failed to read %s: %v\n", file, err)