file, _ := os.Open("x.txt")
f := bufio.NewReader(file)
for {
read_line, _ := ReadString('\n')
fmt.Print(read_line)
// other code what work with parsed line...
}
End it add \n
on every line , end program to work , only work with last line...
Please put example, I try anything end any solution what i find here not work for me.
You can slice off the last character:
read_line = read_line[:len(read_line)-1]
Perhaps a better approach is to use the strings library:
read_line = strings.TrimSuffix(read_line, "\n")