testing dir added
This commit is contained in:
32
testing/test.go
Normal file
32
testing/test.go
Normal 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
4
testing/test.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
3425 423
|
||||
Reference in New Issue
Block a user