From a9801cc2622cf2f9f1ab46060c6ddee1aed87337 Mon Sep 17 00:00:00 2001 From: Mika Suhonen Date: Thu, 30 Nov 2023 19:28:14 +0200 Subject: [PATCH] testing dir added --- testing/test.go | 32 ++++++++++++++++++++++++++++++++ testing/test.txt | 4 ++++ 2 files changed, 36 insertions(+) create mode 100644 testing/test.go create mode 100644 testing/test.txt diff --git a/testing/test.go b/testing/test.go new file mode 100644 index 0000000..2f2048f --- /dev/null +++ b/testing/test.go @@ -0,0 +1,32 @@ +package main + +import ( + "bufio" + "fmt" + "os" +) + +func main() { + + filePath := os.Args[1] + readFile, err := os.Open(filePath) + + if err != nil { + fmt.Println(err) + } + fileScanner := bufio.NewScanner(readFile) + fileScanner.Split(bufio.ScanLines) + var fileLines []string + + for fileScanner.Scan() { + fileLines = append(fileLines, fileScanner.Text()) + } + + readFile.Close() + + for _, line := range fileLines { + fmt.Println(line) + } + + fmt.Println(fileLines) +} diff --git a/testing/test.txt b/testing/test.txt new file mode 100644 index 0000000..5674acd --- /dev/null +++ b/testing/test.txt @@ -0,0 +1,4 @@ +1 +2 +3 +3425 423