From: Ian Lance Taylor Date: Tue, 27 Apr 2021 23:55:04 +0000 (-0700) Subject: os: document that Windows Symlink to missing target creates file symlink X-Git-Tag: go1.17beta1~302 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0d32d9e8a8;p=gostls13.git 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 Reviewed-by: Emmanuel Odeke Run-TryBot: Emmanuel Odeke TryBot-Result: Go Bot --- 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