Source File
readlink.go
Belonging Package
io/fs
// Copyright 2023 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package fs// ReadLinkFS is the interface implemented by a file system// that supports reading symbolic links.type ReadLinkFS interface {FS// ReadLink returns the destination of the named symbolic link.// If there is an error, it should be of type [*PathError].ReadLink(name string) (string, error)// Lstat returns a [FileInfo] describing the named file.// If the file is a symbolic link, the returned [FileInfo] describes the symbolic link.// Lstat makes no attempt to follow the link.// If there is an error, it should be of type [*PathError].Lstat(name string) (FileInfo, error)}// ReadLink returns the destination of the named symbolic link.//// If fsys does not implement [ReadLinkFS], then ReadLink returns an error.func ( FS, string) (string, error) {, := .(ReadLinkFS)if ! {return "", &PathError{Op: "readlink", Path: , Err: ErrInvalid}}return .ReadLink()}// Lstat returns a [FileInfo] describing the named file.// If the file is a symbolic link, the returned [FileInfo] describes the symbolic link.// Lstat makes no attempt to follow the link.//// If fsys does not implement [ReadLinkFS], then Lstat is identical to [Stat].func ( FS, string) (FileInfo, error) {, := .(ReadLinkFS)if ! {return Stat(, )}return .Lstat()}
![]() |
The pages are generated with Golds v0.7.9-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |