update with changes from go1.20.5 to go1.21.4

This commit is contained in:
Scott Feldman
2023-11-13 23:28:14 -08:00
committed by deadprogram
parent be25e1a28e
commit 7c11b88ce6
32 changed files with 139 additions and 347 deletions
+9 -3
View File
@@ -1,4 +1,4 @@
// TINYGO: The following is copied from Go 1.20.5 official implementation.
// TINYGO: The following is copied from Go 1.21.4 official implementation.
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -88,14 +88,20 @@ func hexEscapeNonASCII(s string) string {
return s
}
b := make([]byte, 0, newLen)
var pos int
for i := 0; i < len(s); i++ {
if s[i] >= utf8.RuneSelf {
if pos < i {
b = append(b, s[pos:i]...)
}
b = append(b, '%')
b = strconv.AppendInt(b, int64(s[i]), 16)
} else {
b = append(b, s[i])
pos = i + 1
}
}
if pos < len(s) {
b = append(b, s[pos:]...)
}
return string(b)
}