Skip to content

Commit c4d099d

Browse files
committed
all: support multiple versions of Unicode
Different Go compilers support different versions of Unicode. In general, one should match the version of x/text to match the Unicode version of the Go core. This is quite painful and restrictive in practice. x/text now supports multiple versions of Unicode concurrently which are selected based on the Go compiler used (from 1.7). Change-Id: I9a999bf603872a88932740ca7eb518c247519e06 Reviewed-on: https://go-review.googlesource.com/83235 Run-TryBot: Marcel van Lohuizen <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent 3b24cac commit c4d099d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+45949
-1079
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ This repo uses Semantic versioning (http://semver.org/), so
99
and
1010
1. PATCH version when you make backwards-compatible bug fixes.
1111

12-
A Unicode major and minor version bump is mapped to a major version bump in
13-
x/text.
14-
A path version bump in Unicode is mapped to a minor version bump in x/text.
15-
Note that, consistent with the definitions in semver, until version 1.0.0 of
16-
x/text is reached, the minor version is considered a major version.
17-
So going from 0.1.0 to 0.2.0 is considered to be a major version bump.
12+
Until version 1.0.0 of x/text is reached, the minor version is considered a
13+
major version. So going from 0.1.0 to 0.2.0 is considered to be a major version
14+
bump.
1815

1916
A major new CLDR version is mapped to a minor version increase in x/text.
2017
Any other new CLDR version is mapped to a patch version increase in x/text.
2118

19+
It is important that the Unicode version used in `x/text` matches the one used
20+
by your Go compiler. The `x/text` repository supports multiple versions of
21+
Unicode and will match the version of Unicode to that of the Go compiler. At the
22+
moment this is supported for Go compilers from version 1.7.
23+
2224
## Download/Install
2325

2426
The easiest way to install is to run `go get -u golang.org/x/text`. You can

cases/gen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func genTables() {
207207
}
208208

209209
w := gen.NewCodeWriter()
210-
defer w.WriteGoFile("tables.go", "cases")
210+
defer w.WriteVersionedGoFile("tables.go", "cases")
211211

212212
gen.WriteUnicodeVersion(w)
213213

@@ -761,7 +761,7 @@ func genTablesTest() {
761761

762762
fmt.Fprintln(w, ")")
763763

764-
gen.WriteGoFile("tables_test.go", "cases", w.Bytes())
764+
gen.WriteVersionedGoFile("tables_test.go", "cases", w.Bytes())
765765
}
766766

767767
// These functions are just used for verification that their definition have not

cases/tables.go renamed to cases/tables10.0.0.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cases/tables_test.go renamed to cases/tables10.0.0_test.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cases/tables9.0.0.go

+2,213
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)