symlink

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

README

This came from github.com/docker/docker/pkg/symlink, and has some modifications to remove windows support and also remove the usage of Docker's system pkg.

Package symlink implements EvalSymlinksInScope which is an extension of filepath.EvalSymlinks, as well as a Windows long-path aware version of filepath.EvalSymlinks from the Go standard library.

The code from filepath.EvalSymlinks has been adapted in fs.go. Please read the LICENSE.BSD file that governs fs{,_unix}.go and LICENSE.APACHE for fs_unix_test.go.

Modifications

Note that that this is in fact a fork of Docker's symlink package, because we needed to add support for unprivileged os.Lstat -- which cannot be wrapped safely due to the unsafety of the passed directory (and the fact that the symlink expansion changes how things are handled).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalSymlinks(path string) (string, error)

EvalSymlinks returns the path name after the evaluation of any symbolic links. If path is relative the result will be relative to the current directory, unless one of the components is an absolute symbolic link. This version has been updated to support long paths prepended with `\\?\`.

func FollowSymlinkInScope

func FollowSymlinkInScope(path, root string, fs FsEval) (string, error)

FollowSymlinkInScope is a wrapper around evalSymlinksInScope that returns an absolute path. This function handles paths in a platform-agnostic manner.

Types

type FsEval

type FsEval interface {
	Lstat(path string) (fi os.FileInfo, err error)
	Readlink(path string) (linkname string, err error)
}

FsEval is a mock-friendly (and unpriv.*) friendly way of wrapping filesystem-related functions. Note that this code (and all code referencing it) comes from this fork and is not present in the upstream code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL