os: clarify documentation for O_TRUNC #28699
Labels
Documentation
Issues describing a change to documentation.
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
The comment for
os.O_TRUNC
currently says:go/src/os/file.go
Line 76 in 78c0e1f
The “if possible” part of that comment is ambiguous: on Linux it seems to mean “if the file is a regular file or symlink to a regular file” (i.e., not a stream like
/dev/stdout
), but it could be “impossible” to truncate the file for other reasons (such as a permission error), andos.OpenFile
withos.O_TRUNC
seems to report an error in those cases.We should drop the “if possible” phrase and instead explicitly document the conditions under which
O_TRUNC
is ignored.The text was updated successfully, but these errors were encountered: