Using os.O_WRONLY|os.O_APPEND|os.O_CREATE should work.
Not sure why this is the case. If it's the intended behaviour, the
comment should be amended:
O_RDONLY = syscall.O_RDONLY // open the file read-only.
O_WRONLY = syscall.O_WRONLY // open the file write-only.
O_RDWR = syscall.O_RDWR // open the file read-write.
O_APPEND = syscall.O_APPEND // open the file append-only.
perhaps, instead:
O_APPEND = syscall.O_APPEND // append data to the file when writing.
Andrew
The comment is strictly correct, but it is misleading. It implies that
O_APPEND is part of a group with O_RDONLY, O_WRONLY, and O_RDWR. The
open(2) man page clearly delineates between "access modes" (O_RDONLY,
O_WRONLY, O_RDWR) and "file creation/status flags" (including
O_APPEND). You must always supply one of the former.
I committed a change earlier that alters the comment to disambiguate
the O_APPEND flag from the access modes.
Andrew