aboutsummaryrefslogtreecommitdiff
path: root/src/os/dir.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2024-07-24 10:29:13 -0700
committerDamien Neil <dneil@google.com>2024-07-24 18:24:15 +0000
commit910e6b5fae7cbf84e4a3fcfa6739e20239080bcd (patch)
treebb035d2b1bb39157686a5624d8aacbeff3f1c4e0 /src/os/dir.go
parent074f2761b5ff54c9c9d2e2a720abd29efa5474cc (diff)
downloadgo-910e6b5fae7cbf84e4a3fcfa6739e20239080bcd.tar.xz
os: document CopyFS behavior for symlinks in destination
Also clarify the permissions of created files, and note that CopyFS will not overwrite files. Update a few places in documentation to use 0oXXX for octal consts. For #62484 Change-Id: I208ed2bde250304bc7fac2b93963ba57037e791e Reviewed-on: https://go-review.googlesource.com/c/go/+/600775 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/os/dir.go')
-rw-r--r--src/os/dir.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/os/dir.go b/src/os/dir.go
index 471a291345..dab75b5d43 100644
--- a/src/os/dir.go
+++ b/src/os/dir.go
@@ -132,15 +132,17 @@ func ReadDir(name string) ([]DirEntry, error) {
// CopyFS copies the file system fsys into the directory dir,
// creating dir if necessary.
//
-// Newly created directories and files have their default modes
-// where any bits from the file in fsys that are not part of the
-// standard read, write, and execute permissions will be zeroed
-// out, and standard read and write permissions are set for owner,
-// group, and others while retaining any existing execute bits from
-// the file in fsys.
+// Files are created with mode 0o666 plus any execute permissions
+// from the source, and directories are created with mode 0o777
+// (before umask).
//
-// Symbolic links in fsys are not supported, a *PathError with Err set
-// to ErrInvalid is returned on symlink.
+// CopyFS will not overwrite existing files, and returns an error
+// if a file name in fsys already exists in the destination.
+//
+// Symbolic links in fsys are not supported. A *PathError with Err set
+// to ErrInvalid is returned when copying from a symbolic link.
+//
+// Symbolic links in dir are followed.
//
// Copying stops at and returns the first error encountered.
func CopyFS(dir string, fsys fs.FS) error {