old shit
This commit is contained in:
@@ -1,32 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
filePath := os.Args[1]
|
||||
readFile, err := os.Open(filePath)
|
||||
lines := parse()
|
||||
|
||||
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 {
|
||||
for _, line := range lines {
|
||||
fmt.Println(line)
|
||||
}
|
||||
|
||||
fmt.Println(fileLines)
|
||||
}
|
||||
|
||||
func parse() []string {
|
||||
filePath := os.Args[1]
|
||||
data, _ := os.ReadFile(filePath)
|
||||
chunks := strings.Split(string(data), "\n")
|
||||
return chunks
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user