mirror of
https://github.com/golang/go
synced 2024-11-14 13:20:30 -07:00
os: add precondition doc for Create and OpenFile
Fixes #69836 Change-Id: Ide243c2aa9c6f9d45976f728f97e32c4fbadb720 Reviewed-on: https://go-review.googlesource.com/c/go/+/619316 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
a9ad0ff6ba
commit
cd4820cd19
@ -374,6 +374,7 @@ func Open(name string) (*File, error) {
|
||||
// it is truncated. If the file does not exist, it is created with mode 0o666
|
||||
// (before umask). If successful, methods on the returned File can
|
||||
// be used for I/O; the associated file descriptor has mode O_RDWR.
|
||||
// The directory containing the file must already exist.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func Create(name string) (*File, error) {
|
||||
return OpenFile(name, O_RDWR|O_CREATE|O_TRUNC, 0666)
|
||||
@ -382,7 +383,8 @@ func Create(name string) (*File, error) {
|
||||
// OpenFile is the generalized open call; most users will use Open
|
||||
// or Create instead. It opens the named file with specified flag
|
||||
// (O_RDONLY etc.). If the file does not exist, and the O_CREATE flag
|
||||
// is passed, it is created with mode perm (before umask). If successful,
|
||||
// is passed, it is created with mode perm (before umask);
|
||||
// the containing directory must exist. If successful,
|
||||
// methods on the returned File can be used for I/O.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func OpenFile(name string, flag int, perm FileMode) (*File, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user