testing dir added

This commit is contained in:
2023-11-30 19:28:14 +02:00
parent edfc914c7b
commit a9801cc262
2 changed files with 36 additions and 0 deletions

32
testing/test.go Normal file
View File

@@ -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)
}

4
testing/test.txt Normal file
View File

@@ -0,0 +1,4 @@
1
2
3
3425 423