Skip to content

Commit

Permalink
cmd/go/internal/load: remove unused hasSubdir function
Browse files Browse the repository at this point in the history
No references to this function remain; remove it to avoid confusion
and reduce build overhead.

The last reference was removed in CL 167748.

Change-Id: I9d023c5d8904800edd3898fed79aa9f824dfb46a
Reviewed-on: https://go-review.googlesource.com/c/go/+/181548
Reviewed-by: Emmanuel Odeke <[email protected]>
  • Loading branch information
Bryan C. Mills committed Jun 10, 2019
1 parent 2d75c33 commit 39f7561
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/cmd/go/internal/load/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,8 @@ package load

import (
"path/filepath"
"strings"
)

// hasSubdir reports whether dir is a subdirectory of
// (possibly multiple levels below) root.
// If so, it sets rel to the path fragment that must be
// appended to root to reach dir.
func hasSubdir(root, dir string) (rel string, ok bool) {
if p, err := filepath.EvalSymlinks(root); err == nil {
root = p
}
if p, err := filepath.EvalSymlinks(dir); err == nil {
dir = p
}
const sep = string(filepath.Separator)
root = filepath.Clean(root)
if !strings.HasSuffix(root, sep) {
root += sep
}
dir = filepath.Clean(dir)
if !strings.HasPrefix(dir, root) {
return "", false
}
return filepath.ToSlash(dir[len(root):]), true
}

// expandPath returns the symlink-expanded form of path.
func expandPath(p string) string {
x, err := filepath.EvalSymlinks(p)
Expand Down

0 comments on commit 39f7561

Please sign in to comment.