aboutsummaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-04-27 16:55:04 -0700
committerIan Lance Taylor <iant@golang.org>2021-05-02 18:22:19 +0000
commit0d32d9e8a8784cf3ef39c471b73e502c51085b6d (patch)
tree50e4a537f3e28ed560142b340eb4c48b46270f36 /src/os
parent352a322a8356ef5f7d9392c401cd9f181a1cf80b (diff)
downloadgo-0d32d9e8a8784cf3ef39c471b73e502c51085b6d.tar.gz
go-0d32d9e8a8784cf3ef39c471b73e502c51085b6d.zip
os: document that Windows Symlink to missing target creates file symlink
Fixes #39183 Change-Id: Iec4a5a561182ade57dc7dc24247710005d6b9f21 Reviewed-on: https://go-review.googlesource.com/c/go/+/314275 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/os')
-rw-r--r--src/os/file_plan9.go2
-rw-r--r--src/os/file_unix.go2
-rw-r--r--src/os/file_windows.go2
3 files changed, 6 insertions, 0 deletions
diff --git a/src/os/file_plan9.go b/src/os/file_plan9.go
index 4f384e9211..604aea607b 100644
--- a/src/os/file_plan9.go
+++ b/src/os/file_plan9.go
@@ -440,6 +440,8 @@ func Link(oldname, newname string) error {
}
// Symlink creates newname as a symbolic link to oldname.
+// On Windows, a symlink to a non-existent oldname creates a file symlink;
+// if oldname is later created as a directory the symlink will not work.
// If there is an error, it will be of type *LinkError.
func Symlink(oldname, newname string) error {
return &LinkError{"symlink", oldname, newname, syscall.EPLAN9}
diff --git a/src/os/file_unix.go b/src/os/file_unix.go
index deec41324b..a2531b9656 100644
--- a/src/os/file_unix.go
+++ b/src/os/file_unix.go
@@ -351,6 +351,8 @@ func Link(oldname, newname string) error {
}
// Symlink creates newname as a symbolic link to oldname.
+// On Windows, a symlink to a non-existent oldname creates a file symlink;
+// if oldname is later created as a directory the symlink will not work.
// If there is an error, it will be of type *LinkError.
func Symlink(oldname, newname string) error {
e := ignoringEINTR(func() error {
diff --git a/src/os/file_windows.go b/src/os/file_windows.go
index a2cb96e457..378e2b1c7d 100644
--- a/src/os/file_windows.go
+++ b/src/os/file_windows.go
@@ -327,6 +327,8 @@ func Link(oldname, newname string) error {
}
// Symlink creates newname as a symbolic link to oldname.
+// On Windows, a symlink to a non-existent oldname creates a file symlink;
+// if oldname is later created as a directory the symlink will not work.
// If there is an error, it will be of type *LinkError.
func Symlink(oldname, newname string) error {
// '/' does not work in link's content