From 3dd96e9d82c59755117fd259a836a55098507001 Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Wed, 13 Sep 2017 17:45:51 +0200 Subject: [PATCH] unicode: allow version to be passed by env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This, in turn, to make it work with x/text’s go generate. Also eliminates need to manually update version string in maketables.go. Change-Id: Id5a8b8e27bdce5b1b5920eb9223a2d27b889149a Reviewed-on: https://go-review.googlesource.com/63952 Run-TryBot: Marcel van Lohuizen TryBot-Result: Gobot Gobot Reviewed-by: Nigel Tao --- src/unicode/maketables.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/unicode/maketables.go b/src/unicode/maketables.go index 42864b4a8e9..3fcf8af6bf7 100644 --- a/src/unicode/maketables.go +++ b/src/unicode/maketables.go @@ -41,10 +41,17 @@ func main() { flushOutput() } +func defaultVersion() string { + if v := os.Getenv("UNICODE_VERSION"); v != "" { + return v + } + return unicode.Version +} + var dataURL = flag.String("data", "", "full URL for UnicodeData.txt; defaults to --url/UnicodeData.txt") var casefoldingURL = flag.String("casefolding", "", "full URL for CaseFolding.txt; defaults to --url/CaseFolding.txt") var url = flag.String("url", - "http://www.unicode.org/Public/9.0.0/ucd/", + "http://www.unicode.org/Public/"+defaultVersion()+"/ucd/", "URL of Unicode database directory") var tablelist = flag.String("tables", "all",