I want to do this:
- Read a line from a text file.
- Process the line.
- Delete the line.
My first thought was to read the entire file into memory with ioutil.Readfile()
,
but I'm not sure how to update the text file after the line has been processed,
and what happens if extra lines is added to the text file after it has been read into memory?
I normally write shell scripts and would do something like this:
while read -r line; do
echo "${line}"
sed -i 1d "${myList}"
done < "${myList}"
What is the best way to do this in Golang?