1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:04:39 -07:00

path/filepath.Rel: document that the returned path is always relative

Fixes #2593.

R=rsc, alex.brainman, n13m3y3r
CC=golang-dev
https://golang.org/cl/5500052
This commit is contained in:
Rob Pike 2011-12-21 11:46:42 -08:00
parent 71f0fb7760
commit 18f7c0a3f6

View File

@ -262,6 +262,8 @@ func Abs(path string) (string, error) {
// Rel returns a relative path that is lexically equivalent to targpath when // Rel returns a relative path that is lexically equivalent to targpath when
// joined to basepath with an intervening separator. That is, // joined to basepath with an intervening separator. That is,
// Join(basepath, Rel(basepath, targpath)) is equivalent to targpath itself. // Join(basepath, Rel(basepath, targpath)) is equivalent to targpath itself.
// On success, the returned path will always be relative to basepath,
// even if basepath and targpath share no elements.
// An error is returned if targpath can't be made relative to basepath or if // An error is returned if targpath can't be made relative to basepath or if
// knowing the current working directory would be necessary to compute it. // knowing the current working directory would be necessary to compute it.
func Rel(basepath, targpath string) (string, error) { func Rel(basepath, targpath string) (string, error) {