From: Russ Cox
+
The go
command now defines
architecture feature build tags, such as amd64.v2
,
to allow selecting a package implementation file based on the presence
@@ -432,11 +432,17 @@ proxyHandler := &httputil.ReverseProxy{
- TODO: https://go.dev/cl/407176: strings, bytes: add CutPrefix and CutSuffix
+ The new
+ CutPrefix
and
+ CutSuffix
functions
+ are like TrimPrefix
+ and TrimSuffix
+ but also report whether the string was trimmed.
- TODO: https://go.dev/cl/359675: bytes: add Clone function
+ The new Clone
function
+ allocates a copy of a byte slice.
- TODO: https://go.dev/issue/53346: Add (*Encoder).Close() to check for unclosed elements +
+ The new Encoder.Close
method
+ can be used to check for unclosed elements when finished encoding.
- TODO: https://go.dev/cl/424777: encoding/xml: add (*Encoder).Close -
- -- TODO: https://go.dev/cl/103875: encoding/xml: error when more than one colon in qualified names +
+ The decoder now rejects element and attribute names with more than one colon,
+ such as <a:b:c>
,
+ as well as namespaces that resolve to an empty string, such as xmlns:a=""
.
- TODO: https://go.dev/cl/107255: encoding/xml: error when closing tag does not match opening tag + The decoder now rejects elements that use different namespace prefixes in the opening and closing tag, + even if those prefixes both denote the same namespace.
Errorf
function supports multiple occurrences of
the %w
format verb, returning an error that unwraps to the list of all arguments to %w
.
- - TODO: https://go.dev/issue/51668: add FormatString(State) string -
- -- TODO: https://go.dev/cl/400875: fmt: add a function to recover the original format string given a State; modified api/next/51668.txt +
+ The new FormatString
function recovers the
+ formatting directive corresponding to a State
,
+ which can be useful in Formatter
.
+ implementations.
- TODO: https://go.dev/cl/421434: go/build: add GO$GOARCH-based ToolTags -
-@@ -609,20 +606,21 @@ proxyHandler := &httputil.ReverseProxy{
- TODO: https://go.dev/issue/45899: add OffsetWriter, NewOffsetWriter -
- -- TODO: https://go.dev/cl/406776: io: add OffsetWriter, NewOffsetWriter; modified api/next/45899.txt +
+ The new OffsetWriter
wraps an underlying
+ WriterAt
+ and provides Seek
, Write
, and WriteAt
methods
+ that adjust their effective file offset position by a fixed amount.
- TODO: https://go.dev/cl/363814: path/filepath, io/fs: add SkipAll; modified api/next/47209.txt +
+ The new error SkipAll
+ terminates a WalkDir
+ immediately but successfully.
- TODO: https://go.dev/issue/51766: add IPv6LinkLocalAllRouters -
- -- TODO: https://go.dev/issue/51777: add IPv6Loopback -
- -- TODO: https://go.dev/cl/412475: net/netip: add IPv6LinkLocalAllRouters and IPv6Loopback; modified api/next/51766.txt, api/next/51777.txt +
+ The new IPv6LinkLocalAllRouters
+ and IPv6Loopback functions
+ are the net/netip
equivalents of
+ net.IPv6loopback
and
+ net.IPv6linklocalallrouters
.
- TODO: https://go.dev/cl/363814: path/filepath, io/fs: add SkipAll; modified api/next/47209.txt
+ The new error SkipAll
+ terminates a Walk
+ immediately but successfully.
The new IsLocal
function reports whether a path is
@@ -809,36 +805,29 @@ proxyHandler := &httputil.ReverseProxy{
- TODO: https://go.dev/issue/46746: add Value.Equal, Value.Comparable -
- -- TODO: https://go.dev/issue/48000: add reflect.Value.Grow +
+ The new Value.Comparable
and
+ Value.Equal
methods
+ can be used to compare two Value
s for equality.
+ Comparable
reports whether Equal
is a valid operation for a given Value
receiver.
- TODO: https://go.dev/issue/52376: add Value.SetZero +
+ The new Value.Grow
method
+ extends a slice to guarantee space for another n
elements.
- TODO: https://go.dev/cl/389635: reflect: add Value.Grow -
- -- TODO: https://go.dev/cl/411476: reflect: add Value.SetZero -
- -- TODO: https://go.dev/cl/423794: reflect: add Value.{Comparable,Equal} +
+ The new Value.SetZero
method
+ sets a value to be the zero value for its type.
- TODO: https://go.dev/cl/425184: reflect: fix Value.SetIterXXX to check for the read-only bit -
- -
- TODO: https://go.dev/cl/428757: reflect: deprecate SliceHeader and StringHeader
+ Go 1.18 introduced Value.SetIterKey
+ and Value.SetIterValue
methods.
+ These are optimizations: v.SetIterKey(it)
is meant to be equivalent to v.Set(it.Key())
.
+ The implementations incorrectly omitted a check for use of unexported fields that was present in the unoptimized forms.
+ Go 1.20 corrects these methods to include the unexported field check.
- TODO: https://go.dev/cl/444817: regexp: add ErrLarge error; modified api/next/56041.txt
+ Go 1.19.2 and Go 1.18.7 included a security fix to the regular expression parser,
+ making it reject very large expressions that would consume too much memory.
+ Because Go patch releases do not introduce new API,
+ the parser returned syntax.ErrInternalError
in this case.
+ Go 1.20 adds a more specific error, syntax.ErrLarge
,
+ which the parser now returns instead.
- TODO: https://go.dev/cl/345488: strconv: optimize Parse for []byte arguments -
-- TODO: https://go.dev/issue/42537: add CutPrefix and CutSuffix +
+ The new
+ CutPrefix
and
+ CutSuffix
functions
+ are like TrimPrefix
+ and TrimSuffix
+ but also report whether the string was trimmed.
- TODO: https://go.dev/issue/45038: bytes, strings: add Clone +
+ The new Clone
function
+ allocates a copy of a string.
- TODO: https://go.dev/issue/52746: add DateTime, DateOnly, TimeOnly format constants -
- -- TODO: https://go.dev/cl/412495: time: add DateTime, DateOnly, and TimeOnly +
+ The new time layout constants DateTime
,
+ DateOnly
, and
+ TimeOnly
+ provide names for three of the most common layout strings used in a survey of public Go source code.
- TODO: https://go.dev/cl/382734: time: implement Compare method
+ The new Time.Compare
method
+ compares two times.
- TODO: https://go.dev/cl/425037: time: fix Parse to ignore extra sub-nanosecond digits
+ Parse
+ now ignores sub-nanosecond precision in its input,
+ instead of reporting those digits as an error.
- TODO: https://go.dev/cl/444277: time: implement strict RFC 3339 during marshal and unmarshal
+ The Time.MarshalJSON
and
+ Time.UnmarshalJSON
methods
+ are now more strict about adherence to RFC 3339.
- TODO: https://go.dev/issue/51896: add AppendRune -
- -- TODO: https://go.dev/cl/409054: unicode/utf16: add AppendRune; modified api/next/51896.txt +
+ The new AppendRune
+ function appends the UTF-16 encoding of a given rune to a uint16 slice,
+ analogous to utf8.AppendRune
.