mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
#162 using default GOPATH for win and trim last newline character
This commit is contained in:
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user