Merge pull request #180 from Irioth/patch-1

#162 using default GOPATH for win and trim last newline character
This commit is contained in:
Vasily Romanov
2018-07-16 19:20:36 +03:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -93,5 +93,5 @@ func (p *Parser) Parse(fname string, isDir bool) error {
func getDefaultGoPath() (string, error) {
output, err := exec.Command("go", "env", "GOPATH").Output()
return string(output), err
return strings.TrimSpace(string(output)), err
}
+2 -2
View File
@@ -9,7 +9,7 @@ import (
)
func normalizePath(path string) string {
// use lower case, as Windows file systems will almost always be case insensitive
// use lower case, as Windows file systems will almost always be case insensitive
return strings.ToLower(strings.Replace(path, "\\", "/", -1))
}
@@ -34,7 +34,7 @@ func getPkgPath(fname string, isDir bool) (string, error) {
}
}
for _, p := range strings.Split(os.Getenv("GOPATH"), ";") {
for _, p := range strings.Split(gopath, ";") {
prefix := path.Join(normalizePath(p), "src") + "/"
if rel := strings.TrimPrefix(fname, prefix); rel != fname {
if !isDir {