From 04344266860c2da1d6014afe18dadac2e0484ac4 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 15 Nov 2017 15:44:09 -0500 Subject: [PATCH] doc/go1.10: first draft of release notes Change-Id: If7ec07be4ecb0c1d6a1eb5c0740f150473aea6fa Reviewed-on: https://go-review.googlesource.com/78130 Run-TryBot: Russ Cox Reviewed-by: Russ Cox --- doc/go1.10.html | 1240 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1240 insertions(+) create mode 100644 doc/go1.10.html diff --git a/doc/go1.10.html b/doc/go1.10.html new file mode 100644 index 0000000000..cdc0feee37 --- /dev/null +++ b/doc/go1.10.html @@ -0,0 +1,1240 @@ + + + + + + +

DRAFT RELEASE NOTES - Introduction to Go 1.10

+ +

+ Go 1.10 is not yet released. These are work-in-progress + release notes. Go 1.10 is expected to be released in February 2018. +

+ +

+The latest Go release, version 1.10, arrives six months after go1.9. +Most of its changes are in the implementation of the toolchain, runtime, and libraries. +As always, the release maintains the Go 1 promise of compatibility. +We expect almost all Go programs to continue to compile and run as before. +

+ +

+OVERVIEW HERE +

+ +

Changes to the language

+ +

+There are no substantive changes to the language. +

+ +

+A corner case involving shifts by untyped constants has been clarified, +and as a result the compilers have been updated to allow the index expression +x[1.0 << s] where s is an untyped constant; +the go/types package already did. +

+ +

+The grammar for method expressions has been updated to relax the +syntax to allow any type expression as a receiver; +this matches what the compilers were already implementing. +For example, struct{io.Reader}.Read is a valid, if unusual, +method expression that the compilers already accepted and is +now permitted by the language grammar. +

+ +

Ports

+ +

+There are no new supported operating systems or processor architectures in this release. +Most of the work has focused on strengthening the support for existing ports, +in particular new instructions in the assembler +and improvements to the code generated by the compilers. +

+ +

Tools

+ +

Default GOROOT & GOTMPDIR

+ +

+TODO: default GOROOT changes in cmd/go +TODO: computed GOROOT change +

+ +

+By default, the go tool creates its temporary files and directories +in the system temporary directory (for example, $TMPDIR on Unix). +If the new environment variable $GOTMPDIR is set, +the go tool will creates its temporary files and directories in that directory instead. +

+ +

Build & Install

+ +

+The go build command now detects out-of-date packages +purely based on the content of source files, specified build flags, and metadata stored in the compiled packages. +Modification times are no longer consulted or relevant. +The old advice to add -a to force a rebuild in cases where +the modification times were misleading for one reason or another +(for example, changes in build flags) is no longer necessary: +builds now always detect when packages must be rebuilt. +(If you observe otherwise, please file a bug.) +

+ +

+The go build -asmflags, -gcflags, -gccgoflags, and -ldflags options +now apply by default only to the packages listed directly on the command line. +For example, go build -gcflags=-m mypkg +passes the compiler the -m flag when building mypkg +but not its dependencies. +The new, more general form -asmflags=pattern=flags (and similarly for the others) +applies the flags only to the packages matching the pattern. +For example: go install -ldflags=cmd/gofmt=-X=main.version=1.2.3 cmd/... +installs all the commands matching cmd/... but only applies the -X option +to the linker flags for cmd/gofmt. +For more details, see go help build. +

+ +

+The go build command now maintains a cache of +recently built packages, separate from the installed packages in $GOROOT/pkg or $GOPATH/pkg. +The effect of the cache should be to speed builds that do not explicitly install packages +or when switching between different copies of source code (for example, when changing +back and forth between different branches in a version control system). +The old advice to add the -i flag for speed, as in go build -i +or go test -i, +is no longer necessary: builds run just as fast without -i. +For more details, see go help cache. +

+ +

+The go install command now installs only the +packages and commands listed directly on the command line. +For example, go install cmd/gofmt +installs the gofmt program but not any of the packages on which it depends. +The new build cache makes future commands still run as quickly as if the +dependencies had been installed. +To force the installation of dependencies, use the new +go install -i flag. +Installing dependencies should not be necessary in general, +and the very concept or installed packages may disappear in a future release. +

+ +

+Many details of the go build implementation have changed to support these improvements. +One new requirement implied by these changes is that +binary-only packages must now declare accurate import blocks in their +stub source code, so that those imports can be made available when +linking a program using the binary-only package. +For more details, see go help filetype. +

+ +

Test

+ +

+The go test command now caches test results: +if the test executable and command line match a previous run +and the files and environment variables consulted by that run +have not changed either, go test will print +the previous test output, replacing the elapsed time with the string “(cached).” +Test caching applies only to successful test results; +only to go test +commands with an explicit list of packages; and +only to command lines using a subset of the +-cpu, -list, -parallel, +-run, -short, and -v test flags. +The idiomatic way to bypass test caching is to use -count=1. +

+ +

+The go test command now automatically runs +go vet on the package being tested, +to identify significant problems before running the test. +Any such problems are treated like build errors and prevent execution of the test. +Only a high-confidence subset of the available go vet +checks are enabled for this automatic check. +To disable the running of go vet, use +go test -vet=off. +

+ +

+The go test -coverpkg flag now +interprets its argument as a comma-separated list of patterns to match against +the dependencies of each test, not as a list of packages to load anew. +For example, go test -coverpkg=all +is now a meaningful way to run a test with coverage enabled for the test package +and all its dependencies. +Also, the go test -coverprofile option is now +supported when running multiple tests. +

+ +

+In case of failure due to timeout, tests are now more likely to write their profiles before exiting. +

+ +

+The go test command now always +merges the standard output and standard error from a given test binary execution +and writes both to go test's standard output. +In past releases, go test only applied this +merging most of the time. +

+ +

+The go test -v output +now includes PAUSE and CONT status update +lines to make clearer when parallel tests pause and continue. +

+ +

+Finally, the new go test -json flag +filters test output through the new command +go tool test2json +to produce a machine-readable JSON-formatted description of test execution. +This should allow the creation of rich presentations of test execution +in IDEs and other tools. +

+ + +

+For more details about all these changes, +see go help test +and the test2json documentation. +

+ +

Cgo

+ +

+Cgo now implements a C typedef like “typedef X Y;” using a Go type alias, +so that Go code may use the types C.X and C.Y interchangeably. +It also now supports the use of niladic function-like macros. +Also, the documentation has been updated to clarify that +Go structs and Go arrays are not supported in the type signatures of cgo-exported functions. +

+ +

+During toolchain bootstrap, the environment variables CC and CC_FOR_TARGET specify +the default C compiler that the resulting toolchain will use for host and target builds, respectively. +However, if the toolchain will be used with multiple targets, it may be necessary to specify a different C compiler for each +(for example, a different compiler for darwin/arm64 versus linux/ppc64le). +The new set of environment variables CC_FOR_goos_goarch +allows specifying a different default C compiler for each target. +Note that these variables only apply during toolchain bootstrap, +to set the defaults used by the resulting toolchain. +Later go build commands refer to the CC environment +variable or else the built-in default. +For more details, see the cgo documentation. +

+ +

Doc

+ +

+The go doc tool now adds functions returning slices of T or *T +to the display of type T, similar to the existing behavior for functions returning single T or *T results. +For example: +

+ +
+$ go doc mail.Address
+package mail // import "net/mail"
+
+type Address struct {
+	Name    string 
+	Address string
+}
+    Address represents a single mail address.
+
+func ParseAddress(address string) (*Address, error)
+func ParseAddressList(list string) ([]*Address, error)
+func (a *Address) String() string
+$
+
+ +

+Previously, ParseAddressList was only shown in the package overview (go doc mail). +

+ +

Fix

+ +

+The go fix tool now replaces imports of "golang.org/x/net/context" +with "context". +(Forwarding aliases in the former make it completely equivalent to the latter when using Go 1.9 or later.) +

+ +

Get

+ +

+The go get command now supports Fossil source code repositories. +

+ +

Pprof

+ +

+The blocking and mutex profiles produced by the runtime/pprof package +now include symbol information, so they can be viewed +in go tool pprof +without the binary that produced the profile. +(All other profile types were changed to include symbol information in Go 1.9.) +

+ +

+The go tool pprof profile visualizer has been updated to +the latest version from github.com/google/pprof. +

+ +

Vet

+ +

+The go vet command now always has access to +complete, up-to-date type information when checking packages, even for packages using cgo or vendored imports. +The reports should be more accurate as a result. +Note that only go vet has access to this information; +the more low-level go tool vet does not +and should be avoided except when working on vet itself. +(As of Go 1.9, go vet provides access to all the same flags as +go tool vet.) +

+ +

Diagnostics

+ +

+This release includes a new overview of available Go program diagnostic tools. +

+ +

Gofmt

+ +

+A few minor details of the default formatting of Go source code have changed. +First, some complex three-index slice expressions previously formatted like +x[i+1 : j:k] and now +format with more consistent spacing: x[i+1 : j : k]. +Second, single-method interface literals written on a single line, +which are sometimes used in type assertions, +are no longer split onto multiple lines. +Third, blank lines following an opening brace are now always elided. +

+ +

+Note that these kinds of minor updates to gofmt are expected from time to time. +In general, we recommend against building systems that check that source code +matches the output of a specific version of gofmt. +For example, a continuous integration test that fails if any code already checked into +a repository is not “properly formatted” is inherently fragile and not recommended. +

+ +

+If multiple programs must agree about which version of gofmt is used to format a source file, +we recommend that they do this by arranging to invoke the same gofmt binary. +For example, in the Go open source repository, we arrange for goimports and +our Git pre-commit hook to agree about source code formatting by having both +invoke the gofmt binary found in the current path. +TODO: Make goimports actually do that. #22695. +As another example, inside Google we arrange that source code presubmit +checks run a gofmt binary maintained at a fixed path in a shared, distributed file system; +that on engineering workstations /usr/bin/gofmt +is a symbolic link to that same path; +and that all editor integrations used for Google development +explicitly invoke /usr/bin/gofmt. +TODO: TMI? +

+ +

Compiler Toolchain

+ +

+The compiler includes many improvements to the performance of generated code, +spread fairly evenly across the supported architectures. +

+ +

+TODO: What to say about DWARF work, if anything? +Global constants (CL 61019), variable decomposition (CL 50878), variable liveness and location lists (CL 41770), more? +What is enabled by default? +

+ +

+TODO: What to say about FMA, if anything? +The spec change was mentioned in Go 1.9 but I am not sure whether any new architectures turned it on in Go 1.10. +

+ +

+The various build modes +has been ported to more systems. +Specifically, c-shared now works on linux/ppc64le, windows/386, and windows/amd64; +pie now works on darwin/amd64 and also forces the use of external linking on all systems; +and plugin now works on linux/ppc64le. +

+ +

+The linux/ppc64le port now requires the use of external linking +with any programs that use cgo, even uses by the standard library. +

+ +

Assembler

+ +

+For the ARM 32-bit port, the assembler now supports the instructions +BFC, +BFI, +BFX, +BFXU, +FMULAD, +FMULAF, +FMULSD, +FMULSF, +FNMULAD, +FNMULAF, +FNMULSD, +FNMULSF, +MULAD, +MULAF, +MULSD, +MULSF, +NMULAD, +NMULAF, +NMULD, +NMULF, +NMULSD, +NMULSF, +XTAB, +XTABU, +XTAH, +and +XTAHU. +

+ +

+For the ARM 64-bit port, the assembler now supports the +VADD, +VADDP, +VADDV, +VAND, +VCMEQ, +VDUP, +VEOR, +VLD1, +VMOV, +VMOVI, +VMOVS, +VORR, +VREV32, +and +VST1 +instructions. +

+ +

+For the PowerPC 64-bit port, the assembler now supports the POWER9 instructions +ADDEX, +CMPEQB, +COPY, +DARN, +LDMX, +MADDHD, +MADDHDU, +MADDLD, +MFVSRLD, +MTVSRDD, +MTVSRWS, +PASTECC, +VCMPNEZB, +VCMPNEZBCC, +and +VMSUMUDM. +

+ +

+For the S390X port, the assembler now supports the +TMHH, +TMHL, +TMLH, +and +TMLL +instructions. +

+ +

+For the X86 64-bit port, the assembler now supports 359 new instructions +and is believed to be complete up to and including the Intel AVX-256 extensions. +The assembler also no longer implements MOVL $0, AX +as an XORL instruction, +to avoid clearing the condition flags unexpectedly. +

+ +

Gccgo

+ +

+TODO: Words about GCC 8 and Go 1.10. +

+ +

Runtime

+ +

+TODO: Don't start new threads from locked threads or threads that Go did not create. LockOSThread/UnlockOSThread now nest. LockOSThread + return kills the thread +

+ +

+Stack traces no longer include implicit wrapper functions (previously marked <autogenerated>), +unless a fault or panic happens in the wrapper itself. +

+ +

+There is no longer a limit on the GOMAXPROCS setting. +(In Go 1.9 the limit was 1024.) +

+ +

Performance

+ +

+As always, the changes are so general and varied that precise +statements about performance are difficult to make. Most programs +should run a bit faster, due to speedups in the garbage collector, +better generated code, and optimizations in the core library. +

+ +

Garbage Collector

+ +

+TODO: Anything? +

+ +

Core library

+ +

+All of the changes to the standard library are minor. +The changes in bytes +and net/url are the most likely to require updating of existing programs. +

+ +

Minor changes to the library

+ +

+As always, there are various minor changes and updates to the library, +made with the Go 1 promise of compatibility +in mind. +

+ +
archive/tar
+
+

+In general, the handling of special header formats is significantly improved and expanded. +

+

+FileInfoHeader has always +recorded the Unix UID and GID numbers from its os.FileInfo argument +(specifically, from the system-dependent information returned by the FileInfo's Sys method) +in the returned Header. +Now it also records the user and group names corresponding to those IDs, +as well as the major and minor device numbers for device files. +

+

+Errors created by the package now begin with a consistent “tar:” prefix. +(Previously they almost all began with a consistent “archive/tar:” prefix.) +TODO: Why are we changing these? (#22740) +

+

+The new Header.Format field +of type Format +controls which tar header format the Writer uses. +The default, as before, is to select the most widely-supported header type +that can encoding the fields needed by the header (USTAR if possible, or else PAX if possible, or else GNU). +The Reader sets Header.Format for each header it reads. +

+

+Reader and the Writer now support PAX records, +using the new Header.PAXRecords field. +

+

+The Reader no longer insists that the file name or link name in GNU headers +be valid UTF-8. +

+

+When writing PAX- or GNU-format headers, the Writer now includes +the Header.AccessTime and Header.ChangeTime fields (if set). +When writing PAX-format headers, the times include sub-second precision. +

+

+The Writer.Flush method, +which has had no real effect since Go 1.1, is now marked deprecated. +

+
+ +
archive/zip
+
+

+Go 1.10 adds more complete support for times and character set encodings in ZIP archives. +

+

+The original ZIP format used the standard MS-DOS encoding of year, month, day, hour, minute, and second into fields in two 16-bit values. +That encoding cannot represent time zones or odd seconds, so multiple extensions have been +introduced to allow richer encodings. +In Go 1.10, the Reader and Writer +now support the widely-understood Info-Zip extension that encodes the time separately in the 32-bit Unix “seconds since epoch” form. +The FileHeader's new Modified field of type time.Time +obsoletes the ModifiedTime and ModifiedDate fields, which continue to hold the MS-DOS encoding. +The ModTime and +SetModTime methods +now simply read and write the new Modified field. +The Reader and Writer now adopt the common +convention that ZIP archive storing the Unix time encoding store the local time +in the MS-DOS field, so that the time zone offset can be inferred. +TODO: These last bits are not true but probably should be (#22738) +

+

+The header for each file in a ZIP archive has a flag bit indicating whether +the name and comment fields are encoded as UTF-8, as opposed to a system-specific default encoding. +In Go 1.8 and earlier, the Writer never set the UTF-8 bit. +In Go 1.9, the Writer changed to set the UTF-8 bit almost always. +This broke the creation of ZIP archives containing Shift-JIS file names. +In Go 1.10, the Writer now sets the UTF-8 bit only when +both the name and the comment field are valid UTF-8 and at least one is non-ASCII. +Because non-ASCII encodings very rarely look like valid UTF-8, the new +heuristic should be correct nearly all the time. +Setting a FileHeader's new NonUTF8 field to true +disables the heuristic entirely for that file. +

+

+The Writer also now support setting the end-of-central-directory record's comment field, +by setting the Writer's new Comment field +before calling the Close method. +TODO: May change (#22737). +

+
+ +
bufio
+
+

+The new Reader.Size +and Writer.Size +methods report the Reader or Writer's underlying buffer size. +

+
+ +
bytes
+
+

+The +Fields, +FieldsFunc, +Split, +and +SplitAfter +each already returned slices pointing into the same underlying array as its input. +Go 1.10 changes each of the returned subslices to have capacity equal to its length, +so that appending to a subslice will not overwrite adjacent data in the original input. +

+
+ +
crypto/cipher
+
+

+NewOFB now panics if given +an initialization vector of incorrect length, like the other constructors in the +package always have. +(Previously it returned a nil Stream implementation.) +

+
+ +
crypto/tls
+
+

+The TLS server now advertises support for SHA-512 signatures when using TLS 1.2. +The server already supported the signatures, but some clients would not select +them unless explicitly advertised. +

+
+ +
crypto/x509
+
+

+Leaf certificate validation now enforces the name constraints for all +names contained in the certificate, not just the one name that a client has asked about. +Extended key usage restrictions are similarly now checked all at once. +As a result, after a certificate has been validated, now it can be trusted in its entirety. +It is no longer necessary to revalidate the certificate for each additional name +or key usage. +TODO: Link to docs that may not exist yet. +

+ +

+Parsed certificates also now report URI names and IP, email, and URI constraints, using the new +Certificate fields +URIs, PermittedIPRanges, ExcludedIPRanges, +PermittedEmailAddresses, ExcludedEmailAddresses, +PermittedURIDomains, and ExcludedURIDomains. +

+ +

+The new MarshalPKCS8PrivateKey +function converts a private key to PKCS#8 encoded form. +

+
+ +
crypto/x509/pkix
+
+

+Name now implements a +String method that +formats the X.509 distinguished name in the standard RFC 2253 format. +

+
+ +
database/sql/driver
+
+

+Drivers that want to construct a sql.DB for +their clients can now implement the Connector interface +and call the new sql.OpenDB function, +instead of needing to encode all configuration into a string +passed to sql.Open. +

+

+Drivers that implement ExecerContext +no longer need to implement Execer; +similarly, drivers that implement QueryerContext +no longer need to implement Queryer. +Previously, even if the context-based interfaces were implemented they were ignored +unless the non-context-based interfaces were also implemented. +

+

+To allow drivers to better isolate different clients using a cached driver connection in succession, +if a Conn implements the new +SessionResetter interface, +database/sql will now call ResetSession before +reusing the Conn for a new client. +

+
+ +
debug/elf
+
+

+This release adds 348 new relocation constants divided between the relocation types +R_386, +R_AARCH64, +R_ARM, +R_PPC64, +and +R_X86_64. +

+
+ +
debug/macho
+
+

+Go 1.10 adds support for reading relocations from Mach-O sections, +using the Section struct's new Relocs field +and the newReloc, +RelocTypeARM, +RelocTypeARM64, +RelocTypeGeneric, +and +RelocTypeX86_64 +types and associated constants. +

+

+Go 1.10 also adds support for the LC_RPATH load command, +represented by the types +RpathCmd and +Rpath, +and new named constants +for the various flag bits found in headers. +

+
+ +
encoding/asn1
+
+

+Marshal now correctly encodes +strings containing asterisks as type UTF8String instead of PrintableString, +unless the string is in a struct field with a tag forcing the use of PrintableString. +Marshal also now respects struct tags containing application directives. +

+

+Unmarshal now respects +struct field tags using the explicit and tag +directives. +

+
+ +
encoding/csv
+
+

+Reader now disallows the use of +nonsensical Comma and Comment settings, +such as NUL, carriage return, newline, invalid runes, and the Unicode replacement character, +or setting Comma and Comment equal to each other. +

+

+In the case of a syntax error in a CSV record that spans multiple input lines, Reader +now reports the line on which the record started in the ParseError's new StartLine field. +

+

+Reader also no longer strips carriage return characters +appearing before newline characters in multiline quoted strings. +TODO: Maybe not (#22746). +

+
+ +
encoding/hex
+
+

+The new functions +NewEncoder +and +NewDecoder +provide streaming conversions to and from hexadecimal, +analogous to equivalent functions already in +encoding/base32 +and +encoding/base64. +

+ +

+When the functions +Decode +and +DecodeString +encounter malformed input, +they each now return the number of bytes already converted +along with the error. +Previously they always returned a count of 0 with any error. +

+
+ +
encoding/json
+
+

+The Decoder +adds a new method +DisallowUnknownFields +that causes it to report inputs with unknown JSON fields as a decoding error. +(The default behavior has always been to discard unknown fields.) +

+
+ +
encoding/xml
+
+

+The new function +NewTokenDecoder +is like +NewDecoder +but creates a decoder reading from a TokenReader +instead of an XML-formatted byte stream. +This is meant to enable the construction of XML stream transformers in client libraries. +

+
+ +
flag
+
+

+The default +Usage function now prints +its first line of output to +CommandLine.Output() +instead of assuming os.Stderr, +so that the usage message is properly redirected for +clients using CommandLine.SetOutput. +

+

+PrintDefaults now +adds appropriate indentation after newlines in flag usage strings, +so that multi-line usage strings display nicely. +

+

+FlagSet adds new methods +ErrorHandling, +Name, +and +Output, +to retrieve the settings passed to +NewFlagSet +and +FlagSet.SetOutput. +

+
+ +
go/doc
+
+

+To support the doc change described above, +functions returning slices of T, *T, **T, and so on +are now reported in T's Type's Funcs list, +instead of in the Package's Funcs list. +

+
+ +
go/importer
+
+

+The For function now accepts a non-nil lookup argument. +

+
+ +
go/printer
+
+

+The changes to the default formatting of Go source code +discussed in the gofmt section above +are implemented in the go/printer package +and also affect the output of the higher-level go/format package. +

+
+ +
hash
+
+

+Implementations of the Hash interface are now +encouraged to implement encoding.BinaryMarshaler +and encoding.BinaryUnmarshaler +to allow saving and recreating their internal state, +and all implementations in the standard library +(hash/crc32, crypto/sha256, and so on) +now implement those interfaces. +

+
+ +
html/template
+
+

+The new actions {{"{{break}}"}} and {{"{{continue}}"}} +break out of the innermost {{"{{range"}} ...}} loop, +like the corresponding Go statements. +

+

+TODO: something about the AddParseTree problem (#21844). +

+
+ +
math/big
+
+

+Int now supports conversions to and from bases 2 through 62 +in its SetString and Text methods. +(Previously it only allowed bases 2 through 36.) +The value of the constant MaxBase has been updated. +

+

+Int adds a new +CmpAbs method +that is like Cmp but +compares only the absolute values (not the signs) of its arguments. +

+

+Float adds a new +Sqrt method to +compute square roots. +

+
+ +
math/rand
+
+

+The new function and corresponding +Rand.Shuffle method +shuffle an input sequence. +

+

+The existing function and corresponding +Rand.Perm method +have been updated to use a more efficient algorithm, with the result +that the specific permutations they return have changed. +TODO: Remove? (#22744) +

+
+ +
math
+
+

+The new functions +Round +and +RoundToEven +round their arguments to the nearest integer; +Round rounds a half-integer to its larger integer neighbor (away from zero) +while RoundToEven rounds a half-integer its even integer neighbor. +

+ +

+The new functions +Erfinv +and +Erfcinv +compute the inverse error function and the +inverse complementary error function. +

+
+ +
mime/multipart
+
+

+Reader +now accepts parts with empty filename attributes. +

+
+ +
mime
+
+

+ParseMediaType now discards +invalid attribute values; previously it returned those values as empty strings. +

+
+ +
net
+
+

+The Conn and +Listener implementations +in this package now guarantee that when Close returns, +the underlying file descriptor has been closed. +(In earlier releases, if the Close stopped pending I/O +in other goroutines, the closing of the file descriptor could happen in one of those +goroutines shortly after Close returned.) +

+ +

+TCPListener and +UnixListener +now implement +syscall.Conn, +to allow setting options on the underlying file descriptor +using syscall.RawConn.Control. +

+ +

+The Conn implementations returned by Pipe +now support setting read and write deadlines. +

+ +

+The IPConn.ReadMsgIP, +IPConn.WriteMsgIP, +UDPConn.ReadMsgUDP, +and +UDPConn.WriteMsgUDP, +methods are now implemented on Windows. +

+
+ +
net/http
+
+

+On the client side, an HTTP proxy (most commonly configured by +ProxyFromEnvironment) +can now be specified as an https:// URL, +meaning that the client connects to the proxy over HTTPS before issuing a standard, proxied HTTP request. +(Previously, HTTP proxy URLs were required to begin with http:// or socks5://.) +

+

+On the server side, FileServer and its single-file equivalent ServeFile +now apply If-Range checks to HEAD requests. +FileServer also now reports directory read failures to the Server's ErrorLog. +

+

+Redirect now sets the Content-Type header before writing its HTTP response. +

+
+ +
net/mail
+
+

+ParseAddress and +ParseAddressList and +now support a variety of obsolete address formats. +

+
+ +
net/smtp
+
+

+The Client adds a new +Noop method, +to test whether the server is still responding. +It also now defends against possible SMTP injection in the inputs +to the Hello +and Verify methods. +

+
+ +
net/textproto
+
+

+ReadMIMEHeader +now discards continuation (indented) header lines that appear before the first actual (unindented) header line. +

+
+ +
net/url
+
+

+ResolveReference +now preseves multiple leading slashes in the target URL. +Previously it rewrote multiple leading slashes to a single slash, +which resulted in the http.Client +following certain redirects incorrectly. +

+

+For example, this code's output has changed: +

+
+base, _ := url.Parse("http://host//path//to/page1")
+target, _ := url.Parse("page2")
+fmt.Println(base.ResolveReference(target))
+
+

+Note the doubled slashes around path. +In Go 1.9 and earlier, the resolved URL was http://host/path//to/page2: +the doubled slash before path was incorrectly rewritten +to a single slash, while the doubled slash after path was +correctly preserved. +Go 1.10 preserves both doubled slashes, resolving to http://host//path//to/page2 +as required by RFC 3986. +

+ +

This change may break existing buggy programs that unintentionally +construct a base URL with a leading doubled slash in the path and inadvertently +depend on ResolveReference to correct that mistake. +For example, this can happen if code adds a host prefix +like http://host/ to a path like /my/api, +resulting in a URL with a doubled slash: http://host//my/api. +

+
+ +
os
+
+

+File adds new methods +SetDeadline, +SetReadDeadline, +and +SetWriteDeadline +that allow setting I/O deadlines when the +underlying file descriptor supports non-blocking I/O operations. +The definition of these methods matches those in net.Conn. +

+ +

+Also matching net.Conn, +File's +Close method +now guarantee that when Close returns, +the underlying file descriptor has been closed. +(In earlier releases, like for net.Conn's, +if the Close stopped pending I/O +in other goroutines, the closing of the file descriptor could happen in one of those +goroutines shortly after Close returned.) +

+ +

+On BSD, macOS, and Solaris systems, +Chtimes +now supports setting file times with nanosecond precision +(assuming the underlying file system can represent them). +

+
+ +
reflect
+
+

+The Copy function now allows copying +from a string into a byte array or byte slice, to match the +built-in copy function. +

+
+ +
runtime/pprof
+
+

+As noted above, the blocking and mutex profiles +now include symbol information so that they can be viewed without needing +the binary that generated them. +

+
+ +
strconv
+
+

+ParseUint now returns +the maximum magnitude integer of the appropriate size +with any ErrRange error, as it was already documented to do. +Previously it returned 0 with ErrRange errors. +

+
+ +
strings
+
+

+A new type +Builder is a replacement for +bytes.Buffer for the use case of +accumulating text into a string result. +The Builder's API is a restricted subset of bytes.Buffer's +that allows it to safely avoid making a duplicate copy of the data +during the String method. +

+
+ +
syscall
+
+

+On Windows, +the new SysProcAttr field Token, +of type Token allows the creation of a process that +runs as another user during StartProcess +(and therefore also during os.StartProcess and +exec.Cmd.Start). +The new function CreateProcessAsUser +gives access to the underlying system call. +

+ +

+On BSD, macOS, and Solaris systems, UtimesNano +is now implemented. +

+
+ +
text/template
+
+

+The new actions {{"{{break}}"}} and {{"{{continue}}"}} +break out of the innermost {{"{{range"}} ...}} loop, +like the corresponding Go statements. +

+
+ +
time
+
+

+LoadLocation now uses the directory +or uncompressed zip file named by the $ZONEINFO +environment variable before looking in the default system-specific list of +known installation locations or in $GOROOT/lib/time/zoneinfo.zip. +

+

+TODO: Maybe CL 68890. +

+
+ +
unicode
+
+

+The unicode package and associated +support throughout the system has been upgraded from version 9.0 to +Unicode 10.0, +which adds 8,518 new characters, including four new scripts, one new property, +a Bitcoin currency symbol, and 56 new emoji. +

+
-- 2.50.0