Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 4c1cbbb

Browse files
committed
internal/fs: rename EqualPaths to EquivalentPaths
Signed-off-by: Ibrahim AshShohail <[email protected]>
1 parent 6870bff commit 4c1cbbb

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

context.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (c *Ctx) DetectProjectGOPATH(p *Project) (string, error) {
179179
pGOPATH, perr := c.detectGOPATH(p.AbsRoot)
180180

181181
// If p.AbsRoot is a not symlink, attempt to detect GOPATH for p.AbsRoot only.
182-
if equal, _ := fs.EqualPaths(p.AbsRoot, p.ResolvedAbsRoot); equal {
182+
if equal, _ := fs.EquivalentPaths(p.AbsRoot, p.ResolvedAbsRoot); equal {
183183
return pGOPATH, perr
184184
}
185185

@@ -191,7 +191,7 @@ func (c *Ctx) DetectProjectGOPATH(p *Project) (string, error) {
191191
}
192192

193193
// If pGOPATH equals rGOPATH, then both are within the same GOPATH.
194-
if equal, _ := fs.EqualPaths(pGOPATH, rGOPATH); equal {
194+
if equal, _ := fs.EquivalentPaths(pGOPATH, rGOPATH); equal {
195195
return "", errors.Errorf("both %s and %s are in the same GOPATH %s", p.AbsRoot, p.ResolvedAbsRoot, pGOPATH)
196196
}
197197

internal/fs/fs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ func HasFilepathPrefix(path, prefix string) bool {
102102
return true
103103
}
104104

105-
// EqualPaths compares the paths passed to check if the are equivalent.
105+
// EquivalentPaths compares the paths passed to check if the are equivalent.
106106
// It respects the case-sensitivity of the underlaying filesysyems.
107-
func EqualPaths(p1, p2 string) (bool, error) {
107+
func EquivalentPaths(p1, p2 string) (bool, error) {
108108
p1 = filepath.Clean(p1)
109109
p2 = filepath.Clean(p2)
110110

internal/fs/fs_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func TestHasFilepathPrefix_Files(t *testing.T) {
134134
}
135135
}
136136

137-
func TestEqualPaths(t *testing.T) {
137+
func TestEquivalentPaths(t *testing.T) {
138138
h := test.NewHelper(t)
139139
h.TempDir("dir")
140140
h.TempDir("dir2")
@@ -166,17 +166,17 @@ func TestEqualPaths(t *testing.T) {
166166
}
167167

168168
for _, tc := range testcases {
169-
got, err := EqualPaths(tc.p1, tc.p2)
169+
got, err := EquivalentPaths(tc.p1, tc.p2)
170170
if err != nil && !tc.err {
171171
t.Error("unexpected error:", err)
172172
}
173173
if caseSensitive {
174174
if tc.caseSensitiveEquivalent != got {
175-
t.Errorf("expected EqualPaths(%q, %q) to be %t on case-sensitive filesystem, got %t", tc.p1, tc.p2, tc.caseSensitiveEquivalent, got)
175+
t.Errorf("expected EquivalentPaths(%q, %q) to be %t on case-sensitive filesystem, got %t", tc.p1, tc.p2, tc.caseSensitiveEquivalent, got)
176176
}
177177
} else {
178178
if tc.caseInensitiveEquivalent != got {
179-
t.Errorf("expected EqualPaths(%q, %q) to be %t on case-insensitive filesystem, got %t", tc.p1, tc.p2, tc.caseInensitiveEquivalent, got)
179+
t.Errorf("expected EquivalentPaths(%q, %q) to be %t on case-insensitive filesystem, got %t", tc.p1, tc.p2, tc.caseInensitiveEquivalent, got)
180180
}
181181
}
182182
}

0 commit comments

Comments
 (0)