added comment to windows filePath check

This commit is contained in:
Antonio Fdez 2016-11-19 22:37:11 +01:00 committed by GitHub
parent 9f357f7625
commit 6503447ae7

View File

@ -81,6 +81,7 @@ func loadDataFrom(filePath string) ([]byte, error) {
} }
return ioutil.ReadFile(filePath) return ioutil.ReadFile(filePath)
} else if runtime.GOOS == "windows" && strings.Contains(u.String(), "\\") { } else if runtime.GOOS == "windows" && strings.Contains(u.String(), "\\") {
// on Windows systems u.Path is always empty, so we need to check the string directly.
if _, notFoundFileErr := os.Stat(filePath); notFoundFileErr != nil { if _, notFoundFileErr := os.Stat(filePath); notFoundFileErr != nil {
return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath) return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath)
} }