From 6e2930fc66c7b654bf8420a655553640c7e677ec Mon Sep 17 00:00:00 2001 From: Ibrahim AshShohail Date: Wed, 21 Jun 2017 01:29:39 +0300 Subject: [PATCH] dep: remove usage of filepath.FromSlash & filepath.ToSlash Remove the usage of filepath.FromSlash and filepath.ToSlash in GOPATH detection functions *Ctx.SetPaths and *Ctx.detectGOPATH. This should ensure the GOPATH returned from *Ctx.DetectProjectGOPATH uses the filesystem separator instead of slashes. Signed-off-by: Ibrahim AshShohail --- context.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/context.go b/context.go index 0d6c8fe826..94f840161a 100644 --- a/context.go +++ b/context.go @@ -64,9 +64,8 @@ func (c *Ctx) SetPaths(wd string, GOPATHs ...string) error { if len(GOPATHs) == 0 { GOPATHs = getGOPATHs(os.Environ()) } - for _, gp := range GOPATHs { - c.GOPATHs = append(c.GOPATHs, filepath.ToSlash(gp)) - } + + c.GOPATHs = append(c.GOPATHs, GOPATHs...) return nil } @@ -230,7 +229,7 @@ func (c *Ctx) DetectProjectGOPATH(p *Project) (string, error) { // detectGOPATH detects the GOPATH for a given path from ctx.GOPATHs. func (c *Ctx) detectGOPATH(path string) (string, error) { for _, gp := range c.GOPATHs { - if fs.HasFilepathPrefix(filepath.FromSlash(path), gp) { + if fs.HasFilepathPrefix(path, gp) { return gp, nil } }