diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-10-31 16:36:17 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-10-31 16:40:08 +0000 |
commit | e0a1ccb64a637673195804513902cba6b1d4e97c (patch) | |
tree | abc1598be28cda231d92cda8fb10b49eeb564c29 /vendor/golang.org/x/text/internal/gen | |
parent | 7bad329d417f19ba4aae2b4607281c2bc5df8ad7 (diff) |
Update dependencies
Diffstat (limited to 'vendor/golang.org/x/text/internal/gen')
-rw-r--r-- | vendor/golang.org/x/text/internal/gen/gen.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/vendor/golang.org/x/text/internal/gen/gen.go b/vendor/golang.org/x/text/internal/gen/gen.go index 9eb2987..84c699f 100644 --- a/vendor/golang.org/x/text/internal/gen/gen.go +++ b/vendor/golang.org/x/text/internal/gen/gen.go @@ -85,7 +85,11 @@ func CLDRVersion() string { // IsLocal reports whether data files are available locally. func IsLocal() bool { - if _, err := os.Stat(localReadmeFile()); err != nil { + dir, err := localReadmeFile() + if err != nil { + return false + } + if _, err = os.Stat(dir); err != nil { return false } return true @@ -130,19 +134,22 @@ var ( const permissions = 0755 -func localReadmeFile() string { +func localReadmeFile() (string, error) { p, err := build.Import("golang.org/x/text", "", build.FindOnly) if err != nil { - log.Fatalf("Could not locate package: %v", err) + return "", fmt.Errorf("Could not locate package: %v", err) } - return filepath.Join(p.Dir, "DATA", "README") + return filepath.Join(p.Dir, "DATA", "README"), nil } func getLocalDir() string { dirMutex.Lock() defer dirMutex.Unlock() - readme := localReadmeFile() + readme, err := localReadmeFile() + if err != nil { + log.Fatal(err) + } dir := filepath.Dir(readme) if _, err := os.Stat(readme); err != nil { if err := os.MkdirAll(dir, permissions); err != nil { |