Skip to content

Commit 3dd96e9

Browse files
committed
unicode: allow version to be passed by env var
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Nigel Tao <[email protected]>
1 parent 0bbb666 commit 3dd96e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/unicode/maketables.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ func main() {
4141
flushOutput()
4242
}
4343

44+
func defaultVersion() string {
45+
if v := os.Getenv("UNICODE_VERSION"); v != "" {
46+
return v
47+
}
48+
return unicode.Version
49+
}
50+
4451
var dataURL = flag.String("data", "", "full URL for UnicodeData.txt; defaults to --url/UnicodeData.txt")
4552
var casefoldingURL = flag.String("casefolding", "", "full URL for CaseFolding.txt; defaults to --url/CaseFolding.txt")
4653
var url = flag.String("url",
47-
"http://www.unicode.org/Public/9.0.0/ucd/",
54+
"http://www.unicode.org/Public/"+defaultVersion()+"/ucd/",
4855
"URL of Unicode database directory")
4956
var tablelist = flag.String("tables",
5057
"all",

0 commit comments

Comments
 (0)