diff options
| author | Bryan C. Mills <bcmills@google.com> | 2023-12-04 15:32:01 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-12-07 17:27:54 +0000 |
| commit | bb34112d4df7b5dfd12fc83b8d1305631a7b8708 (patch) | |
| tree | df6e817d1136455672b11f491019bd728459d260 /src/os/file_plan9.go | |
| parent | 4601857c1c7f5f72c75366763ff71fdcbe5f84be (diff) | |
| download | go-bb34112d4df7b5dfd12fc83b8d1305631a7b8708.tar.xz | |
os: document Readlink behavior for relative links
Also provide a runnable example to illustrate that behavior.
This should help users to avoid the common mistake of expecting
os.Readlink to return an absolute path.
Fixes #57766.
Change-Id: I8f60aa111ebda0cae985758615019aaf26d5cb41
Reviewed-on: https://go-review.googlesource.com/c/go/+/546995
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/os/file_plan9.go')
| -rw-r--r-- | src/os/file_plan9.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/os/file_plan9.go b/src/os/file_plan9.go index 03cdb5be4a..4cab2d4cdf 100644 --- a/src/os/file_plan9.go +++ b/src/os/file_plan9.go @@ -505,9 +505,7 @@ func Symlink(oldname, newname string) error { return &LinkError{"symlink", oldname, newname, syscall.EPLAN9} } -// Readlink returns the destination of the named symbolic link. -// If there is an error, it will be of type *PathError. -func Readlink(name string) (string, error) { +func readlink(name string) (string, error) { return "", &PathError{Op: "readlink", Path: name, Err: syscall.EPLAN9} } |
