...
1# Go Text
2
3[](https://pkg.go.dev/golang.org/x/text)
4
5This repository holds supplementary Go packages for text processing,
6many involving Unicode.
7
8## CLDR Versioning
9
10It is important that the Unicode version used in `x/text` matches the one used
11by your Go compiler. The `x/text` repository supports multiple versions of
12Unicode and will match the version of Unicode to that of the Go compiler. At the
13moment this is supported for Go compilers from version 1.7.
14
15## Contribute
16
17To submit changes to this repository, see http://go.dev/doc/contribute.
18
19The git repository is https://go.googlesource.com/text.
20
21To generate the tables in this repository (except for the encoding tables),
22run go generate from this directory. By default tables are generated for the
23Unicode version in core and the CLDR version defined in
24golang.org/x/text/unicode/cldr.
25
26Running go generate will as a side effect create a DATA subdirectory in this
27directory, which holds all files that are used as a source for generating the
28tables. This directory will also serve as a cache.
29
30## Testing
31
32Run
33
34 go test ./...
35
36from this directory to run all tests. Add the "-tags icu" flag to also run
37ICU conformance tests (if available). This requires that you have the correct
38ICU version installed on your system.
39
40TODO:
41- updating unversioned source files.
42
43## Generating Tables
44
45To generate the tables in this repository (except for the encoding
46tables), run `go generate` from this directory. By default tables are
47generated for the Unicode version in core and the CLDR version defined in
48golang.org/x/text/unicode/cldr.
49
50Running go generate will as a side effect create a DATA subdirectory in this
51directory which holds all files that are used as a source for generating the
52tables. This directory will also serve as a cache.
53
54## Versions
55
56To update a Unicode version run
57
58 UNICODE_VERSION=x.x.x go generate
59
60where `x.x.x` must correspond to a directory in https://www.unicode.org/Public/.
61If this version is newer than the version in core it will also update the
62relevant packages there. The idna package in x/net will always be updated.
63
64To update a CLDR version run
65
66 CLDR_VERSION=version go generate
67
68where `version` must correspond to a directory in
69https://www.unicode.org/Public/cldr/.
70
71Note that the code gets adapted over time to changes in the data and that
72backwards compatibility is not maintained.
73So updating to a different version may not work.
74
75The files in DATA/{iana|icu|w3|whatwg} are currently not versioned.
76
77## Report Issues
78
79The main issue tracker for the text repository is located at
80https://go.dev/issues. Prefix your issue with "x/text:" in the
81subject line, so it is easy to find.
View as plain text