godoc/static: mimic the pre-1.10 behavior of strconv.Quote
Thanks to iant for identifying the root cause. Tested with go1.9 and go1.10. Fixes golang/go#25880 Change-Id: Ibc3a2aadd92c1e512cf6c537134ee085398e8e6c Reviewed-on: https://go-review.googlesource.com/118955 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
49ce10d933
commit
903a227b9b
|
@ -88,7 +88,15 @@ func Generate() ([]byte, error) {
|
|||
fmt.Fprintf(buf, ",\n\n")
|
||||
}
|
||||
fmt.Fprintln(buf, "}")
|
||||
return format.Source(buf.Bytes())
|
||||
|
||||
b := buf.Bytes()
|
||||
|
||||
// The 鿥 U+9FE5 character became printable in go 1.10,
|
||||
// causing it to appear literally in newer output.
|
||||
// Force the old behavior.
|
||||
b = bytes.Replace(b, []byte("\u9fe5"), []byte(`\u9fe5`), -1)
|
||||
|
||||
return format.Source(b)
|
||||
}
|
||||
|
||||
// sanitize prepares a valid UTF-8 string as a raw string constant.
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//+build go1.10
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
|
Loading…
Reference in New Issue