So I can read from a local file like so:
data, error := ioutil.ReadFile(name)
And I can write to a local file
ioutil.WriteFile(filename, content, permission)
But how can I append to a file? Is there a built in method?
So I can read from a local file like so:
data, error := ioutil.ReadFile(name)
And I can write to a local file
ioutil.WriteFile(filename, content, permission)
But how can I append to a file? Is there a built in method?
If you also want to create the file
f, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
This answers works in Go1:
... I would use fmt.Fprintf, because accept a writer... and a connection or files will be a writer and easy to write in a way of string...
I hope this help!
Javier,
Figured it out
More info
Go docs has a perfect example :