Skip to content

Commit

Permalink
Add Windows compatibility to ImportPathForDir
Browse files Browse the repository at this point in the history
  • Loading branch information
dissipative committed Jul 9, 2019
1 parent d2c5bf2 commit 0d8167d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/code/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"

Expand Down Expand Up @@ -75,7 +76,8 @@ func ImportPathForDir(dir string) (res string) {
}

// Walked all the way to the root and didnt find anything :'(
if modDir == "/" {
if modDir == "/" ||
runtime.GOOS == "windows" && modDir == filepath.VolumeName(modDir)+string(filepath.Separator) {
break
}
}
Expand Down

0 comments on commit 0d8167d

Please sign in to comment.