diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-29 12:46:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 12:46:30 -0700 |
commit | b84736e9b6401df0c6eeab9950bef09458a6aefd (patch) | |
tree | d9175208de3236db75a33879750a57b3000ba096 /vendor/golang.org/x/text/gen.go | |
parent | 8b9dbb86133ff0fd6002a391268383d1593918ca (diff) | |
download | chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.gz chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.bz2 chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.zip |
Updating server dependancies. (#7538)
Diffstat (limited to 'vendor/golang.org/x/text/gen.go')
-rw-r--r-- | vendor/golang.org/x/text/gen.go | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/vendor/golang.org/x/text/gen.go b/vendor/golang.org/x/text/gen.go index 79af97e70..4257a1839 100644 --- a/vendor/golang.org/x/text/gen.go +++ b/vendor/golang.org/x/text/gen.go @@ -25,7 +25,9 @@ import ( "sync" "unicode" + "golang.org/x/text/collate" "golang.org/x/text/internal/gen" + "golang.org/x/text/language" ) var ( @@ -72,14 +74,24 @@ func main() { fmt.Printf("Requested Unicode version %s; core unicode version is %s.\n", gen.UnicodeVersion(), unicode.Version) - // TODO: use collate to compare. Simple comparison will work, though, - // until Unicode reaches version 10. To avoid circular dependencies, we - // could use the NumericWeighter without using package collate using a - // trivial Weighter implementation. - if gen.UnicodeVersion() < unicode.Version && !*force { + c := collate.New(language.Und, collate.Numeric) + if c.CompareString(gen.UnicodeVersion(), unicode.Version) < 0 && !*force { os.Exit(2) } updateCore = true + goroot := os.Getenv("GOROOT") + appendToFile( + filepath.Join(goroot, "api", "except.txt"), + fmt.Sprintf("pkg unicode, const Version = %q\n", unicode.Version), + ) + const lines = `pkg unicode, const Version = %q +// TODO: add a new line of the following form for each new script and property. +pkg unicode, var <new script or property> *RangeTable +` + appendToFile( + filepath.Join(goroot, "api", "next.txt"), + fmt.Sprintf(lines, gen.UnicodeVersion()), + ) } var unicode = &dependency{} @@ -132,6 +144,20 @@ func main() { vprintf("SUCCESS\n") } +func appendToFile(file, text string) { + fmt.Println("Augmenting", file) + w, err := os.OpenFile(file, os.O_APPEND|os.O_WRONLY, 0600) + if err != nil { + fmt.Println("Failed to open file:", err) + os.Exit(1) + } + defer w.Close() + if _, err := w.WriteString(text); err != nil { + fmt.Println("Failed to write to file:", err) + os.Exit(1) + } +} + var ( all sync.WaitGroup hasErrors bool @@ -244,7 +270,7 @@ func copyPackage(dirSrc, dirDst, search, replace string) { base := filepath.Base(file) if err != nil || info.IsDir() || !strings.HasSuffix(base, ".go") || - strings.HasSuffix(base, "_test.go") && !strings.HasPrefix(base, "example") || + strings.HasSuffix(base, "_test.go") || // Don't process subdirectories. filepath.Dir(file) != dirSrc { return nil |