This question already has an answer here:
- Append to a file in Go 5 answers
I find os.Open() return a O_RDONLY file and os.Create() return a O_RDWR but can't find a method return a APPEND file pointer.
Any help ?
</div>
This question already has an answer here:
I find os.Open() return a O_RDONLY file and os.Create() return a O_RDWR but can't find a method return a APPEND file pointer.
Any help ?
</div>
The OpenFile takes a flags argument that you can use:
os.OpenFile("foo.txt", os.O_RDWR|os.O_APPEND, 0660);
Used with O_CREATE , OpenFile can also serve the same purpose as os.Create()