From bb34112d4df7b5dfd12fc83b8d1305631a7b8708 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Mon, 4 Dec 2023 15:32:01 -0500 Subject: 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Carlos Amedee Reviewed-by: Rob Pike --- src/os/file_plan9.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/os/file_plan9.go') 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} } -- cgit v1.3