Bump golang.org/x/text to 0.3.3

To fix CVE-2020-14040.
This commit is contained in:
Jan Safranek 2020-08-17 12:39:12 +02:00
parent 76c089312a
commit 57a7112c3b
18 changed files with 22055 additions and 67 deletions

1
go.mod
View File

@ -13,6 +13,7 @@ require (
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/spf13/cobra v0.0.3 github.com/spf13/cobra v0.0.3
golang.org/x/net v0.0.0-20190415100556-4a65cf94b679 golang.org/x/net v0.0.0-20190415100556-4a65cf94b679
golang.org/x/text v0.3.3 // indirect
google.golang.org/grpc v1.20.0 google.golang.org/grpc v1.20.0
k8s.io/api v0.0.0-20190415132514-c2f1300cac21 k8s.io/api v0.0.0-20190415132514-c2f1300cac21
k8s.io/apiextensions-apiserver v0.0.0-20190315093550-53c4693659ed // indirect k8s.io/apiextensions-apiserver v0.0.0-20190315093550-53c4693659ed // indirect

2
go.sum
View File

@ -213,6 +213,8 @@ golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db h1:6/JqlYfC1CCaLnGceQTI+sDGhC9UBSPAsBqI0Gun6kU= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db h1:6/JqlYfC1CCaLnGceQTI+sDGhC9UBSPAsBqI0Gun6kU=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20161028155119-f51c12702a4d h1:TnM+PKb3ylGmZvyPXmo9m/wktg7Jn/a/fNmr33HSj8g= golang.org/x/time v0.0.0-20161028155119-f51c12702a4d h1:TnM+PKb3ylGmZvyPXmo9m/wktg7Jn/a/fNmr33HSj8g=
golang.org/x/time v0.0.0-20161028155119-f51c12702a4d/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20161028155119-f51c12702a4d/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

@ -538,8 +538,6 @@ const (
// ISO111ECMACyrillic is the MIB identifier with IANA name ECMA-cyrillic. // ISO111ECMACyrillic is the MIB identifier with IANA name ECMA-cyrillic.
// //
// ISO registry // ISO registry
// (formerly ECMA
// registry )
ISO111ECMACyrillic MIB = 77 ISO111ECMACyrillic MIB = 77
// ISO121Canadian1 is the MIB identifier with IANA name CSA_Z243.4-1985-1. // ISO121Canadian1 is the MIB identifier with IANA name CSA_Z243.4-1985-1.
@ -732,18 +730,18 @@ const (
// ISO885913 is the MIB identifier with IANA name ISO-8859-13. // ISO885913 is the MIB identifier with IANA name ISO-8859-13.
// //
// ISO See http://www.iana.org/assignments/charset-reg/ISO-8859-13 http://www.iana.org/assignments/charset-reg/ISO-8859-13 // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-13 https://www.iana.org/assignments/charset-reg/ISO-8859-13
ISO885913 MIB = 109 ISO885913 MIB = 109
// ISO885914 is the MIB identifier with IANA name ISO-8859-14. // ISO885914 is the MIB identifier with IANA name ISO-8859-14.
// //
// ISO See http://www.iana.org/assignments/charset-reg/ISO-8859-14 // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-14
ISO885914 MIB = 110 ISO885914 MIB = 110
// ISO885915 is the MIB identifier with IANA name ISO-8859-15. // ISO885915 is the MIB identifier with IANA name ISO-8859-15.
// //
// ISO // ISO
// Please see: http://www.iana.org/assignments/charset-reg/ISO-8859-15 // Please see: https://www.iana.org/assignments/charset-reg/ISO-8859-15
ISO885915 MIB = 111 ISO885915 MIB = 111
// ISO885916 is the MIB identifier with IANA name ISO-8859-16. // ISO885916 is the MIB identifier with IANA name ISO-8859-16.
@ -754,41 +752,41 @@ const (
// GBK is the MIB identifier with IANA name GBK. // GBK is the MIB identifier with IANA name GBK.
// //
// Chinese IT Standardization Technical Committee // Chinese IT Standardization Technical Committee
// Please see: http://www.iana.org/assignments/charset-reg/GBK // Please see: https://www.iana.org/assignments/charset-reg/GBK
GBK MIB = 113 GBK MIB = 113
// GB18030 is the MIB identifier with IANA name GB18030. // GB18030 is the MIB identifier with IANA name GB18030.
// //
// Chinese IT Standardization Technical Committee // Chinese IT Standardization Technical Committee
// Please see: http://www.iana.org/assignments/charset-reg/GB18030 // Please see: https://www.iana.org/assignments/charset-reg/GB18030
GB18030 MIB = 114 GB18030 MIB = 114
// OSDEBCDICDF0415 is the MIB identifier with IANA name OSD_EBCDIC_DF04_15. // OSDEBCDICDF0415 is the MIB identifier with IANA name OSD_EBCDIC_DF04_15.
// //
// Fujitsu-Siemens standard mainframe EBCDIC encoding // Fujitsu-Siemens standard mainframe EBCDIC encoding
// Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-15 // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-15
OSDEBCDICDF0415 MIB = 115 OSDEBCDICDF0415 MIB = 115
// OSDEBCDICDF03IRV is the MIB identifier with IANA name OSD_EBCDIC_DF03_IRV. // OSDEBCDICDF03IRV is the MIB identifier with IANA name OSD_EBCDIC_DF03_IRV.
// //
// Fujitsu-Siemens standard mainframe EBCDIC encoding // Fujitsu-Siemens standard mainframe EBCDIC encoding
// Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF03-IRV // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF03-IRV
OSDEBCDICDF03IRV MIB = 116 OSDEBCDICDF03IRV MIB = 116
// OSDEBCDICDF041 is the MIB identifier with IANA name OSD_EBCDIC_DF04_1. // OSDEBCDICDF041 is the MIB identifier with IANA name OSD_EBCDIC_DF04_1.
// //
// Fujitsu-Siemens standard mainframe EBCDIC encoding // Fujitsu-Siemens standard mainframe EBCDIC encoding
// Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-1 // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-1
OSDEBCDICDF041 MIB = 117 OSDEBCDICDF041 MIB = 117
// ISO115481 is the MIB identifier with IANA name ISO-11548-1. // ISO115481 is the MIB identifier with IANA name ISO-11548-1.
// //
// See http://www.iana.org/assignments/charset-reg/ISO-11548-1 // See https://www.iana.org/assignments/charset-reg/ISO-11548-1
ISO115481 MIB = 118 ISO115481 MIB = 118
// KZ1048 is the MIB identifier with IANA name KZ-1048. // KZ1048 is the MIB identifier with IANA name KZ-1048.
// //
// See http://www.iana.org/assignments/charset-reg/KZ-1048 // See https://www.iana.org/assignments/charset-reg/KZ-1048
KZ1048 MIB = 119 KZ1048 MIB = 119
// Unicode is the MIB identifier with IANA name ISO-10646-UCS-2. // Unicode is the MIB identifier with IANA name ISO-10646-UCS-2.
@ -855,7 +853,7 @@ const (
// SCSU is the MIB identifier with IANA name SCSU. // SCSU is the MIB identifier with IANA name SCSU.
// //
// SCSU See http://www.iana.org/assignments/charset-reg/SCSU // SCSU See https://www.iana.org/assignments/charset-reg/SCSU
SCSU MIB = 1011 SCSU MIB = 1011
// UTF7 is the MIB identifier with IANA name UTF-7. // UTF7 is the MIB identifier with IANA name UTF-7.
@ -884,22 +882,22 @@ const (
// CESU8 is the MIB identifier with IANA name CESU-8. // CESU8 is the MIB identifier with IANA name CESU-8.
// //
// https://www.unicode.org/unicode/reports/tr26 // https://www.unicode.org/reports/tr26
CESU8 MIB = 1016 CESU8 MIB = 1016
// UTF32 is the MIB identifier with IANA name UTF-32. // UTF32 is the MIB identifier with IANA name UTF-32.
// //
// https://www.unicode.org/unicode/reports/tr19/ // https://www.unicode.org/reports/tr19/
UTF32 MIB = 1017 UTF32 MIB = 1017
// UTF32BE is the MIB identifier with IANA name UTF-32BE. // UTF32BE is the MIB identifier with IANA name UTF-32BE.
// //
// https://www.unicode.org/unicode/reports/tr19/ // https://www.unicode.org/reports/tr19/
UTF32BE MIB = 1018 UTF32BE MIB = 1018
// UTF32LE is the MIB identifier with IANA name UTF-32LE. // UTF32LE is the MIB identifier with IANA name UTF-32LE.
// //
// https://www.unicode.org/unicode/reports/tr19/ // https://www.unicode.org/reports/tr19/
UTF32LE MIB = 1019 UTF32LE MIB = 1019
// BOCU1 is the MIB identifier with IANA name BOCU-1. // BOCU1 is the MIB identifier with IANA name BOCU-1.
@ -1461,152 +1459,152 @@ const (
// IBM00858 is the MIB identifier with IANA name IBM00858. // IBM00858 is the MIB identifier with IANA name IBM00858.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM00858 // IBM See https://www.iana.org/assignments/charset-reg/IBM00858
IBM00858 MIB = 2089 IBM00858 MIB = 2089
// IBM00924 is the MIB identifier with IANA name IBM00924. // IBM00924 is the MIB identifier with IANA name IBM00924.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM00924 // IBM See https://www.iana.org/assignments/charset-reg/IBM00924
IBM00924 MIB = 2090 IBM00924 MIB = 2090
// IBM01140 is the MIB identifier with IANA name IBM01140. // IBM01140 is the MIB identifier with IANA name IBM01140.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01140 // IBM See https://www.iana.org/assignments/charset-reg/IBM01140
IBM01140 MIB = 2091 IBM01140 MIB = 2091
// IBM01141 is the MIB identifier with IANA name IBM01141. // IBM01141 is the MIB identifier with IANA name IBM01141.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01141 // IBM See https://www.iana.org/assignments/charset-reg/IBM01141
IBM01141 MIB = 2092 IBM01141 MIB = 2092
// IBM01142 is the MIB identifier with IANA name IBM01142. // IBM01142 is the MIB identifier with IANA name IBM01142.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01142 // IBM See https://www.iana.org/assignments/charset-reg/IBM01142
IBM01142 MIB = 2093 IBM01142 MIB = 2093
// IBM01143 is the MIB identifier with IANA name IBM01143. // IBM01143 is the MIB identifier with IANA name IBM01143.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01143 // IBM See https://www.iana.org/assignments/charset-reg/IBM01143
IBM01143 MIB = 2094 IBM01143 MIB = 2094
// IBM01144 is the MIB identifier with IANA name IBM01144. // IBM01144 is the MIB identifier with IANA name IBM01144.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01144 // IBM See https://www.iana.org/assignments/charset-reg/IBM01144
IBM01144 MIB = 2095 IBM01144 MIB = 2095
// IBM01145 is the MIB identifier with IANA name IBM01145. // IBM01145 is the MIB identifier with IANA name IBM01145.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01145 // IBM See https://www.iana.org/assignments/charset-reg/IBM01145
IBM01145 MIB = 2096 IBM01145 MIB = 2096
// IBM01146 is the MIB identifier with IANA name IBM01146. // IBM01146 is the MIB identifier with IANA name IBM01146.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01146 // IBM See https://www.iana.org/assignments/charset-reg/IBM01146
IBM01146 MIB = 2097 IBM01146 MIB = 2097
// IBM01147 is the MIB identifier with IANA name IBM01147. // IBM01147 is the MIB identifier with IANA name IBM01147.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01147 // IBM See https://www.iana.org/assignments/charset-reg/IBM01147
IBM01147 MIB = 2098 IBM01147 MIB = 2098
// IBM01148 is the MIB identifier with IANA name IBM01148. // IBM01148 is the MIB identifier with IANA name IBM01148.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01148 // IBM See https://www.iana.org/assignments/charset-reg/IBM01148
IBM01148 MIB = 2099 IBM01148 MIB = 2099
// IBM01149 is the MIB identifier with IANA name IBM01149. // IBM01149 is the MIB identifier with IANA name IBM01149.
// //
// IBM See http://www.iana.org/assignments/charset-reg/IBM01149 // IBM See https://www.iana.org/assignments/charset-reg/IBM01149
IBM01149 MIB = 2100 IBM01149 MIB = 2100
// Big5HKSCS is the MIB identifier with IANA name Big5-HKSCS. // Big5HKSCS is the MIB identifier with IANA name Big5-HKSCS.
// //
// See http://www.iana.org/assignments/charset-reg/Big5-HKSCS // See https://www.iana.org/assignments/charset-reg/Big5-HKSCS
Big5HKSCS MIB = 2101 Big5HKSCS MIB = 2101
// IBM1047 is the MIB identifier with IANA name IBM1047. // IBM1047 is the MIB identifier with IANA name IBM1047.
// //
// IBM1047 (EBCDIC Latin 1/Open Systems) http://www-1.ibm.com/servers/eserver/iseries/software/globalization/pdf/cp01047z.pdf // IBM1047 (EBCDIC Latin 1/Open Systems) https://www-1.ibm.com/servers/eserver/iseries/software/globalization/pdf/cp01047z.pdf
IBM1047 MIB = 2102 IBM1047 MIB = 2102
// PTCP154 is the MIB identifier with IANA name PTCP154. // PTCP154 is the MIB identifier with IANA name PTCP154.
// //
// See http://www.iana.org/assignments/charset-reg/PTCP154 // See https://www.iana.org/assignments/charset-reg/PTCP154
PTCP154 MIB = 2103 PTCP154 MIB = 2103
// Amiga1251 is the MIB identifier with IANA name Amiga-1251. // Amiga1251 is the MIB identifier with IANA name Amiga-1251.
// //
// See http://www.amiga.ultranet.ru/Amiga-1251.html // See https://www.amiga.ultranet.ru/Amiga-1251.html
Amiga1251 MIB = 2104 Amiga1251 MIB = 2104
// KOI7switched is the MIB identifier with IANA name KOI7-switched. // KOI7switched is the MIB identifier with IANA name KOI7-switched.
// //
// See http://www.iana.org/assignments/charset-reg/KOI7-switched // See https://www.iana.org/assignments/charset-reg/KOI7-switched
KOI7switched MIB = 2105 KOI7switched MIB = 2105
// BRF is the MIB identifier with IANA name BRF. // BRF is the MIB identifier with IANA name BRF.
// //
// See http://www.iana.org/assignments/charset-reg/BRF // See https://www.iana.org/assignments/charset-reg/BRF
BRF MIB = 2106 BRF MIB = 2106
// TSCII is the MIB identifier with IANA name TSCII. // TSCII is the MIB identifier with IANA name TSCII.
// //
// See http://www.iana.org/assignments/charset-reg/TSCII // See https://www.iana.org/assignments/charset-reg/TSCII
TSCII MIB = 2107 TSCII MIB = 2107
// CP51932 is the MIB identifier with IANA name CP51932. // CP51932 is the MIB identifier with IANA name CP51932.
// //
// See http://www.iana.org/assignments/charset-reg/CP51932 // See https://www.iana.org/assignments/charset-reg/CP51932
CP51932 MIB = 2108 CP51932 MIB = 2108
// Windows874 is the MIB identifier with IANA name windows-874. // Windows874 is the MIB identifier with IANA name windows-874.
// //
// See http://www.iana.org/assignments/charset-reg/windows-874 // See https://www.iana.org/assignments/charset-reg/windows-874
Windows874 MIB = 2109 Windows874 MIB = 2109
// Windows1250 is the MIB identifier with IANA name windows-1250. // Windows1250 is the MIB identifier with IANA name windows-1250.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1250 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1250
Windows1250 MIB = 2250 Windows1250 MIB = 2250
// Windows1251 is the MIB identifier with IANA name windows-1251. // Windows1251 is the MIB identifier with IANA name windows-1251.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1251 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1251
Windows1251 MIB = 2251 Windows1251 MIB = 2251
// Windows1252 is the MIB identifier with IANA name windows-1252. // Windows1252 is the MIB identifier with IANA name windows-1252.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1252 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1252
Windows1252 MIB = 2252 Windows1252 MIB = 2252
// Windows1253 is the MIB identifier with IANA name windows-1253. // Windows1253 is the MIB identifier with IANA name windows-1253.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1253 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1253
Windows1253 MIB = 2253 Windows1253 MIB = 2253
// Windows1254 is the MIB identifier with IANA name windows-1254. // Windows1254 is the MIB identifier with IANA name windows-1254.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1254 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1254
Windows1254 MIB = 2254 Windows1254 MIB = 2254
// Windows1255 is the MIB identifier with IANA name windows-1255. // Windows1255 is the MIB identifier with IANA name windows-1255.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1255 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1255
Windows1255 MIB = 2255 Windows1255 MIB = 2255
// Windows1256 is the MIB identifier with IANA name windows-1256. // Windows1256 is the MIB identifier with IANA name windows-1256.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1256 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1256
Windows1256 MIB = 2256 Windows1256 MIB = 2256
// Windows1257 is the MIB identifier with IANA name windows-1257. // Windows1257 is the MIB identifier with IANA name windows-1257.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1257 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1257
Windows1257 MIB = 2257 Windows1257 MIB = 2257
// Windows1258 is the MIB identifier with IANA name windows-1258. // Windows1258 is the MIB identifier with IANA name windows-1258.
// //
// Microsoft http://www.iana.org/assignments/charset-reg/windows-1258 // Microsoft https://www.iana.org/assignments/charset-reg/windows-1258
Windows1258 MIB = 2258 Windows1258 MIB = 2258
// TIS620 is the MIB identifier with IANA name TIS-620. // TIS620 is the MIB identifier with IANA name TIS-620.
@ -1616,6 +1614,6 @@ const (
// CP50220 is the MIB identifier with IANA name CP50220. // CP50220 is the MIB identifier with IANA name CP50220.
// //
// See http://www.iana.org/assignments/charset-reg/CP50220 // See https://www.iana.org/assignments/charset-reg/CP50220
CP50220 MIB = 2260 CP50220 MIB = 2260
) )

View File

@ -6,6 +6,7 @@
package unicode // import "golang.org/x/text/encoding/unicode" package unicode // import "golang.org/x/text/encoding/unicode"
import ( import (
"bytes"
"errors" "errors"
"unicode/utf16" "unicode/utf16"
"unicode/utf8" "unicode/utf8"
@ -25,15 +26,95 @@ import (
// the introduction of some kind of error type for conveying the erroneous code // the introduction of some kind of error type for conveying the erroneous code
// point. // point.
// UTF8 is the UTF-8 encoding. // UTF8 is the UTF-8 encoding. It neither removes nor adds byte order marks.
var UTF8 encoding.Encoding = utf8enc var UTF8 encoding.Encoding = utf8enc
// UTF8BOM is an UTF-8 encoding where the decoder strips a leading byte order
// mark while the encoder adds one.
//
// Some editors add a byte order mark as a signature to UTF-8 files. Although
// the byte order mark is not useful for detecting byte order in UTF-8, it is
// sometimes used as a convention to mark UTF-8-encoded files. This relies on
// the observation that the UTF-8 byte order mark is either an illegal or at
// least very unlikely sequence in any other character encoding.
var UTF8BOM encoding.Encoding = utf8bomEncoding{}
type utf8bomEncoding struct{}
func (utf8bomEncoding) String() string {
return "UTF-8-BOM"
}
func (utf8bomEncoding) ID() (identifier.MIB, string) {
return identifier.Unofficial, "x-utf8bom"
}
func (utf8bomEncoding) NewEncoder() *encoding.Encoder {
return &encoding.Encoder{
Transformer: &utf8bomEncoder{t: runes.ReplaceIllFormed()},
}
}
func (utf8bomEncoding) NewDecoder() *encoding.Decoder {
return &encoding.Decoder{Transformer: &utf8bomDecoder{}}
}
var utf8enc = &internal.Encoding{ var utf8enc = &internal.Encoding{
&internal.SimpleEncoding{utf8Decoder{}, runes.ReplaceIllFormed()}, &internal.SimpleEncoding{utf8Decoder{}, runes.ReplaceIllFormed()},
"UTF-8", "UTF-8",
identifier.UTF8, identifier.UTF8,
} }
type utf8bomDecoder struct {
checked bool
}
func (t *utf8bomDecoder) Reset() {
t.checked = false
}
func (t *utf8bomDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
if !t.checked {
if !atEOF && len(src) < len(utf8BOM) {
if len(src) == 0 {
return 0, 0, nil
}
return 0, 0, transform.ErrShortSrc
}
if bytes.HasPrefix(src, []byte(utf8BOM)) {
nSrc += len(utf8BOM)
src = src[len(utf8BOM):]
}
t.checked = true
}
nDst, n, err := utf8Decoder.Transform(utf8Decoder{}, dst[nDst:], src, atEOF)
nSrc += n
return nDst, nSrc, err
}
type utf8bomEncoder struct {
written bool
t transform.Transformer
}
func (t *utf8bomEncoder) Reset() {
t.written = false
t.t.Reset()
}
func (t *utf8bomEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
if !t.written {
if len(dst) < len(utf8BOM) {
return nDst, 0, transform.ErrShortDst
}
nDst = copy(dst, utf8BOM)
t.written = true
}
n, nSrc, err := utf8Decoder.Transform(utf8Decoder{}, dst[nDst:], src, atEOF)
nDst += n
return nDst, nSrc, err
}
type utf8Decoder struct{ transform.NopResetter } type utf8Decoder struct{ transform.NopResetter }
func (utf8Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { func (utf8Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
@ -287,16 +368,13 @@ func (u *utf16Decoder) Reset() {
} }
func (u *utf16Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { func (u *utf16Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
if len(src) < 2 && atEOF && u.current.bomPolicy&requireBOM != 0 {
return 0, 0, ErrMissingBOM
}
if len(src) == 0 { if len(src) == 0 {
if atEOF && u.current.bomPolicy&requireBOM != 0 {
return 0, 0, ErrMissingBOM
}
return 0, 0, nil return 0, 0, nil
} }
if u.current.bomPolicy&acceptBOM != 0 { if len(src) >= 2 && u.current.bomPolicy&acceptBOM != 0 {
if len(src) < 2 {
return 0, 0, transform.ErrShortSrc
}
switch { switch {
case src[0] == 0xfe && src[1] == 0xff: case src[0] == 0xfe && src[1] == 0xff:
u.current.endianness = BigEndian u.current.endianness = BigEndian

View File

@ -530,7 +530,7 @@ func (r Region) String() string {
// Note that not all regions have a 3-letter ISO code. // Note that not all regions have a 3-letter ISO code.
// In such cases this method returns "ZZZ". // In such cases this method returns "ZZZ".
func (r Region) ISO3() string { func (r Region) ISO3() string {
return r.regionID.String() return r.regionID.ISO3()
} }
// M49 returns the UN M.49 encoding of r, or 0 if this encoding // M49 returns the UN M.49 encoding of r, or 0 if this encoding

View File

@ -493,7 +493,7 @@ func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err erro
return dstL.n, srcL.p, err return dstL.n, srcL.p, err
} }
// Deprecated: use runes.Remove instead. // Deprecated: Use runes.Remove instead.
func RemoveFunc(f func(r rune) bool) Transformer { func RemoveFunc(f func(r rune) bool) Transformer {
return removeF(f) return removeF(f)
} }
@ -648,7 +648,8 @@ func String(t Transformer, s string) (result string, n int, err error) {
// Transform the remaining input, growing dst and src buffers as necessary. // Transform the remaining input, growing dst and src buffers as necessary.
for { for {
n := copy(src, s[pSrc:]) n := copy(src, s[pSrc:])
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], pSrc+n == len(s)) atEOF := pSrc+n == len(s)
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], atEOF)
pDst += nDst pDst += nDst
pSrc += nSrc pSrc += nSrc
@ -659,6 +660,9 @@ func String(t Transformer, s string) (result string, n int, err error) {
dst = grow(dst, pDst) dst = grow(dst, pDst)
} }
} else if err == ErrShortSrc { } else if err == ErrShortSrc {
if atEOF {
return string(dst[:pDst]), pSrc, err
}
if nSrc == 0 { if nSrc == 0 {
src = grow(src, 0) src = grow(src, 0)
} }

View File

@ -480,15 +480,15 @@ func (s *isolatingRunSequence) resolveWeakTypes() {
// Rule W1. // Rule W1.
// Changes all NSMs. // Changes all NSMs.
preceedingCharacterType := s.sos precedingCharacterType := s.sos
for i, t := range s.types { for i, t := range s.types {
if t == NSM { if t == NSM {
s.types[i] = preceedingCharacterType s.types[i] = precedingCharacterType
} else { } else {
if t.in(LRI, RLI, FSI, PDI) { if t.in(LRI, RLI, FSI, PDI) {
preceedingCharacterType = ON precedingCharacterType = ON
} }
preceedingCharacterType = t precedingCharacterType = t
} }
} }

View File

@ -1,6 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
// +build go1.10 // +build go1.10,!go1.13
package bidi package bidi

1887
vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

1923
vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
// +build go1.10 // +build go1.10,!go1.13
package norm package norm

7693
vendor/golang.org/x/text/unicode/norm/tables11.0.0.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

7710
vendor/golang.org/x/text/unicode/norm/tables12.0.0.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,18 @@ package width
import "strconv" import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[Neutral-0]
_ = x[EastAsianAmbiguous-1]
_ = x[EastAsianWide-2]
_ = x[EastAsianNarrow-3]
_ = x[EastAsianFullwidth-4]
_ = x[EastAsianHalfwidth-5]
}
const _Kind_name = "NeutralEastAsianAmbiguousEastAsianWideEastAsianNarrowEastAsianFullwidthEastAsianHalfwidth" const _Kind_name = "NeutralEastAsianAmbiguousEastAsianWideEastAsianNarrowEastAsianFullwidthEastAsianHalfwidth"
var _Kind_index = [...]uint8{0, 7, 25, 38, 53, 71, 89} var _Kind_index = [...]uint8{0, 7, 25, 38, 53, 71, 89}

View File

@ -1,6 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
// +build go1.10 // +build go1.10,!go1.13
package width package width

1330
vendor/golang.org/x/text/width/tables11.0.0.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

1350
vendor/golang.org/x/text/width/tables12.0.0.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

2
vendor/modules.txt vendored
View File

@ -181,7 +181,7 @@ golang.org/x/oauth2/internal
golang.org/x/sys/cpu golang.org/x/sys/cpu
golang.org/x/sys/unix golang.org/x/sys/unix
golang.org/x/sys/windows golang.org/x/sys/windows
# golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db # golang.org/x/text v0.3.3
golang.org/x/text/encoding golang.org/x/text/encoding
golang.org/x/text/encoding/charmap golang.org/x/text/encoding/charmap
golang.org/x/text/encoding/htmlindex golang.org/x/text/encoding/htmlindex