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

Commit

Permalink
Merge pull request #778 from ibrasho-forks/remove-slashing-in-SetPath…
Browse files Browse the repository at this point in the history
…s-DetectProjectGOPATH

dep: remove usage of filepath.FromSlash & filepath.ToSlash in context.go
  • Loading branch information
ibrasho authored Jun 22, 2017
2 parents c79b048 + 6e2930f commit ec50ada
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit ec50ada

Please sign in to comment.