diff --git a/doc/go1.6.html b/doc/go1.6.html new file mode 100644 index 0000000000..dbdf3cede6 --- /dev/null +++ b/doc/go1.6.html @@ -0,0 +1,838 @@ + + + + + + +

+NOTE: This is a DRAFT of the Go 1.6 release notes, prepared for the Go 1.6 beta. +Go 1.6 has NOT yet been released. +By our regular schedule, it is expected some time in February 2016. + +

+ +

Introduction to Go 1.6

+ +

+The latest Go release, version 1.6, arrives six months after 1.5. +Most of its changes are in the implementation of the language, runtime, and libraries. +There are no changes to the language specification. +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. +

+ +

+The release adds new ports to Linux on 64-bit MIPS and Android on 32-bit x86; +defined and enforced rules for sharing Go pointers with C; +transparent, automatic support for HTTP/2; +and a new mechanism for template reuse. +

+ +

Changes to the language

+ +

+There are no language changes in this release. +

+ +

Ports

+ +

+Go 1.6 adds experimental ports to +Linux on 64-bit MIPS (linux/mips64 and linux/mips64le). +These ports support cgo but only with internal linking. +

+ +

+Go 1.6 also adds an experimental port to Android on 32-bit x86 (android/386). +

+ +

+On FreeBSD, Go 1.6 defaults to using clang, not gcc, as the external C compiler. +

+ +

+On Linux on little-endian 64-bit PowerPC (linux/ppc64le), +Go 1.6 now supports cgo with external linking and +is roughly feature complete. +

+ +

+On NaCl, Go 1.5 required SDK version pepper-41. +Go 1.6 adds support for later SDK versions. +

+ +
+TODO: CX no longer available on 386 assembly? (https://golang.org/cl/16386)
+
+ +

Tools

+ +

Cgo

+ +

+There is one major change to cgo, along with one minor change. +

+ +

+The major change is the definition of rules for sharing Go pointers with C code, +to ensure that such C code can coexist with Go's garbage collector. +Briefly, Go and C may share memory allocated by Go +when a pointer to that memory is passed to C as part of a cgo call, +provided that the memory itself contains no pointers to Go-allocated memory, +and provided that C does not retain the pointer after the call returns. +These rules are checked by the runtime during program execution: +if the runtime detects a violation, it prints a diagnosis and crashes the program. +The checks can be disabled by setting the environment variable +GODEBUG=cgocheck=0, but note that the vast majority of +code identified by the checks is subtly incompatible with garbage collection +in one way or another. +Disabling the checks will typically only lead to more mysterious failure modes. +Fixing the code in question should be strongly preferred +over turning off the checks. +See the cgo documentation for more details. +

+ +

+The minor change is +the addition of explicit C.complexfloat and C.complexdouble types, +separate from Go's complex64 and complex128. +Matching the other numeric types, C's complex types and Go's complex type are +no longer interchangeable. +

+ +

Compiler Toolchain

+ +

+The compiler toolchain is mostly unchanged. +Internally, the most significant change is that the parser is now hand-written +instead of generated from yacc. +

+ +

+The compiler, linker, and go command have new flag -msan, +analogous to -race and only available on linux/amd64, +that enables interoperation with the Clang MemorySanitizer. +Such interoperation useful mainly for testing a program containing suspect C or C++ code. +

+ +

+The linker has a new option -libgcc to set the expected location +of the C compiler support library when linking cgo code. +The option is only consulted when using -linkmode=internal, +and it may be set to none to disable the use of a support library. +

+ +

+TODO: Something about build modes. +

+ +

+As a reminder, the linker's -X flag changed in Go 1.5. +In Go 1.4 and earlier, it took two arguments, as in +

+ +
+-X importpath.name value
+
+ +

+Go 1.5 added an alternative syntax using a single argument +that is itself a name=value pair: +

+ +
+-X importpath.name=value
+
+ +

+In Go 1.5 the old syntax was still accepted, after printing a warning +suggesting use of the new syntax instead. +Go 1.6 continues to accept the old syntax and print the warning. +Go 1.7 will remove support for the old syntax. +

+ +

Gccgo

+ +

+The release schedules for the GCC and Go projects do not coincide. +GCC release 5 contains the Go 1.4 version of gccgo. +The next release, GCC 6, will have the Go 1.5 version of gccgo. +Due to release scheduling, it is likely that +Go 1.6 will not be in a GCC release until GCC 7. +

+ +

Go command

+ +

+The go command's basic operation +is unchanged, but there are a number of changes worth noting. +

+ +

+Go 1.5 introduced experimental support for vendoring, +enabled by setting the GO15VENDOREXPERIMENT environment variable to 1. +Go 1.6 keeps the vendoring support, no longer considered experimental, +and enables it by default. +It can be disabled explicitly by setting +the GO15VENDOREXPERIMENT environment variable to 0. +Go 1.7 will remove support for the environment variable. +

+ +

+The most likely problem caused by enabling vendoring by default happens +in source trees containing an existing directory named vendor that +does not expect to be interpreted according to new vendoring semantics. +In this case, the simplest fix is to rename the directory to anything other +than vendor and update any affected import paths. +

+ +

+For details about vendoring, +see the documentation for the go command +and the design document. +

+ +

+There is a new build flag, -msan, +that compiles Go with support for the LLVM memory sanitizer. +This is intended mainly for use when linking against C or C++ code +that is being checked with the memory sanitizer. +

+ +

Go doc command

+ +

+Go 1.5 introduced the +go doc command, +which allows references to packages using only the package name, as in +go doc http. +In the event of ambiguity, the Go 1.5 behavior was to use the package +with the lexicographically earliest import path. +In Go 1.6, ambiguity is resolved by preferring import paths with +fewer elements, breaking ties using lexicographic comparison. +An important effect of this change is that original copies of packages +are now preferred over vendored copies. +Successful searches also tend to run faster. +

+ +

Go vet command

+ +

+The go vet command now diagnoses +passing function or method values as arguments to Printf, +such as when passing f where f() was intended. +

+ +

Performance

+ +

+As always, the changes are so general and varied that precise statements +about performance are difficult to make. +Some programs may run faster, some slower. +On average the programs in the Go 1 benchmark suite run a few percent faster in Go 1.6 +than they did in Go 1.5. +The garbage collector's pauses are even lower than in Go 1.5, +although the effect is likely only noticeable for programs using +a large amount of memory. +

+ +

+There have been significant optimizations bringing more than 10% improvements +to implementations of the +compress/bzip2, +compress/gzip, +crypto/aes, +crypto/elliptic, +crypto/ecdsa, and +sort packages. +

+ +

Core library

+ +

HTTP

+ +

+Go 1.6 adds transparent support in the +net/http package +for the new HTTP/2 protocol. +Go clients and servers will automatically use HTTP/2 as appropriate when using HTTPS. +There is no exported API specific to details of the HTTP/2 protocol handling, +just as there is no exported API specific to HTTP/1.1. +

+ +

+Programs that must disable HTTP/2 can do so by setting +Transport.TLSNextProto (for clients) +or +Server.TLSNextProto (for servers) +to a non-nil, empty map. +

+ +

+Programs that must adjust HTTP/2 protocol-specific details can import and use +golang.org/x/net/http2, +in particular its +ConfigureServer +and +ConfigureTransport +functions. +

+ +

Runtime

+ +

+For program-ending panics, the runtime now by default +prints only the stack of the running goroutine, +not all existing goroutines. +Usually only the current goroutine is relevant to a panic, +so omitting the others significantly reduces irrelevant output +in a crash message. +To see the stacks from all goroutines in crash messages, set the environment variable +GOTRACEBACK to all +and rerun the program. +See the runtime documentation for details. +

+ +

+The runtime has added lightweight, best-effort detection of concurrent misuse of maps. +As always, if one goroutine is writing to a map, no other goroutine should be +reading or writing the map concurrently. +If the runtime detects this condition, it prints a diagnosis and crashes the program. +The best way to find out more about the problem is to run the program +under the +race detector, +which will more reliably identify the race +and give more detail. +

+ +

Reflect

+ +

+The +reflect package has +resolved a long-standing incompatibility +between the gc and gccgo toolchains +regarding embedded unexported struct types containing exported fields. +Code that walks data structures using reflection, especially to implement +serialization in the spirit +of the +encoding/json and +encoding/xml packages, +may need to be updated. +

+ +

+The problem arises when using reflection to walk through +an embedded unexported struct-typed field +into an exported field of that struct. +In this case, reflect had incorrectly reported +the embedded field as exported, by returning an empty Field.PkgPath. +Now it correctly reports the field as unexported +but ignores that fact when evaluating access to exported fields +contained within the struct. +

+ +

+Updating: +Typically, code that previously walked over structs and used +

+ +
+f.PkgPath != ""
+
+ +

+to exclude inaccessible fields +should now use +

+ +
+f.PkgPath != "" && !f.Anonymous
+
+ +

+For example, see the changes to the implementations of +encoding/json and +encoding/xml. +

+ +

Sorting

+ +

+In the +sort +package, +the implementation of +Sort +has been rewritten to make about 10% fewer calls to the +Interface's +Less and Swap +methods, with a corresponding overall time savings. +The new algorithm does choose a different ordering than before +for values that compare equal (those pairs for which Less(i, j) and Less(j, i) are false). +

+ +

+Updating: +The definition of Sort makes no guarantee about the final order of equal values, +but the new behavior may still break programs that expect a specific order. +Such programs should either refine their Less implementations +to report the desired order +or should switch to +Stable, +which preserves the original input order +of equal values. +

+ +

Templates

+ +

+In the +text/template package, +there are two significant new features to make writing templates easier. +

+ +

+First, it is now possible to trim spaces around template actions, +which can make template definitions more readable. +A minus sign at the beginning of an action says to trim space before the action, +and a minus sign at the end of an action says to trim space after the action. +For example, the template +

+ +
+{{"{{"}}23 -}}
+   <
+{{"{{"}}- 45}}
+
+ +

+formats as 23<45. +

+ +

+Second, the new {{"{{"}}block}} action, +combined with allowing redefinition of named templates, +provides a simple way to define pieces of a template that +can be replaced in different instantiations. +For example, the template +

+ +
+<title>{{"{{"}}block "title"}}Page Title{{"{{"}}end}}</title>
+<body>
+<h1>{{"{{"}}template "title"}}</h1>
+{{"{{"}}block "page"}}Main text{{"{{"}}end}}
+
+ +

+defines the basic formatting of a web page. A program can then +overlay that template with new definitions for the "title" +and "page" blocks to reuse the formatting for another page. +

+ +

Minor changes to the library

+ + + diff --git a/doc/go1.6.txt b/doc/go1.6.txt deleted file mode 100644 index c6fcba5117..0000000000 --- a/doc/go1.6.txt +++ /dev/null @@ -1,96 +0,0 @@ -Tools: - -cmd/cgo: fix C.complexfloat and C.complexdouble and treat as separate types from complex64 and complex128 (https://golang.org/cl/17208) -cmd/cgo: new pointer passing rules defined and enforced (https://golang.org/issue/12416, https://golang.org/issue/17064) -cmd/compile: parser now hand-written -cmd/compile: add -msan option (https://golang.org/cl/16160) -cmd/dist: use clang on FreeBSD (https://golang.org/cl/16635) -cmd/doc: search packages in breadth-first order (https://golang.org/cl/17691) -cmd/go: vendoring enabled by default (https://golang.org/cl/13967/) -cmd/go: flags for tests must precede package name if present; also makes it easier to pass flags to test binaries (https://golang.org/cl/14826) -cmd/go: add -msan option (https://golang.org/cl/16169) -cmd/go: -buildmode=pie now default on android/arm (https://golang.org/cl/16055) -cmd/link: add -libgcc option (https://golang.org/cl/16993) -cmd/link: add -msan option (https://golang.org/cl/16161) -cmd/vet: diagnose using Printf on a func value -cmd/vet: -all -shadow means all the default checks and the shadow check (https://golang.org/cl/16325) - -Ports: - -Add new experimental ports for linux/mips64 and linux/mips64le: no cgo, external linking or disasm yet (https://golang.org/cl/14460 and others) -NaCl is no longer restricted to pepper_41 (https://golang.org/cl/13958/) - -cmd/go: new -buildmode=shared, -buildmode=pie - -CX no longer available for 386 assembly? (https://golang.org/cl/16386) - -Reflect change: -cmd/compile/internal/gc: make embedded unexported structs RO (https://golang.org/cl/14085) -encoding/json: check for exported fields in embedded structs (https://golang.org/cl/14011) -encoding/xml: check for exported fields in embedded structs (https://golang.org/cl/14012) -reflect: adjust access to unexported embedded structs (https://golang.org/cl/14010) - -API additions and behavior changes: - -archive/zip: per-file compressors (https://golang.org/cl/16669) -bufio: add Scanner.Buffer (https://golang.org/cl/14599/) -bufio: add ErrFinalToken as a sentinel value for Scan's split functions (https://golang.org/cl/14924) -compress/bzip2: about 20% faster to decode (https://golang.org/cl/13853) -compress/flate: deprecate ReadError, WriteError (https://golang.org/cl/14834) -compress/flate: detect truncated streams (https://golang.org/cl/14833) -compress/gzip: detect truncated streams (https://golang.org/cl/14832) -compress/zlib: detect truncated streams (https://golang.org/cl/14835) -crypto/aes: dedicated asm version of AES-GCM (https://golang.org/cl/10484) -crypto/elliptic, ecrypto/ecdsa: P256 assembly (https://golang.org/cl/8968) -crypto/tls: allow tls.Listen when only GetCertifite is provided (https://golang.org/cl/13801) -crypto/tls: support for TSA_RSA_WITH_AES_128_GCM_SHA256 and TLS_RSA_WITH_AES_256_GCM_SHA384 (https://golang.org/cl/16924) -crypto/tls: RecordHeaderError (https://golang.org/cl/16078) -crypto/x509: permit negative serial numbers (https://golang.org/cl/17247) -crypto/x509: InsecureAlgorithmError (https://golang.org/cl/17400) -debug/elf: supports old-style compressed DWARF (https://golang.org/cl/17340) -debug/elf: transparent decompress of compressed sections (https://golang.org/cl/17341) -encoding/asn1: export tag and class constants (https://golang.org/cl/17311) -encoding/asn1: enforce use of short form lengths (https://golang.org/cl/16517) -encoding/asn1: reject invalid integers (https://golang.org/cl/17008) -encoding/json: Number marshaling check validity (https://golang.org/cl/12250) -encoding/xml: ,cdata attribute (https://golang.org/cl/16047) -encoding/xml: SyntaxError for prematurely ended XML (https://golang.org/cl/14315) -fmt: allow any integer type as an argument to the * operator (https://golang.org/cl/14491/) -fmt: scan %X for strings (https://golang.org/cl/15689) -image: add NYCbCrA types (https://golang.org/cl/15671) -io: MultiWriter now supports WriteString (https://golang.org/cl/12485) -math/big: new API Int.Text, Int.Append (https://golang.org/cl/14994) -math/big: Float implements TextMarshaler, TextUnmarshaler (https://golang.org/cl/15050) -math/big: -1 precision now works for float.Append -math/rand: add Read (https://golang.org/cl/14522) -net: ParseMAC now accepts 20-byte IPoIB link-layer addresses -net: DNS server error now reported as Temporary (https://golang.org/cl/14169) -net: rooted DNS names on Windows (https://golang.org/cl/13887), Plan 9 (https://golang.org/cl/15581) -net: https://golang.org/cl/17216 is "localhost." (possible bug; see https://golang.org/issue/13564) -net/http: new error codes from RFC 6585 (https://golang.org/cl/15732) -net/http: Client supports Expect: 100-continue (https://golang.org/cl/10091) -net/http: HTTP/2.0 support (many CLs) -net/http: FileServer now sorts directory entries (https://golang.org/cl/14161) -net/http: ResponseRecorder detects Content-Type (https://golang.org/cl/16096) -net/http: req.Method=="" now follows redirects like req.Method=="GET" (https://golang.org/cl/17318) -net/http: make NewRequest with empty method set Method==GET (https://golang.org/cl/17699) -net/url: make *url.Error implement net.Error (https://golang.org/cl/15672) -net/url: processing of host name stricter, more spec compliant (https://golang.org/cl/17387) -os: IsPermission, IsExist, and IsNotExist now handle *os.SyscallError (https://golang.org/cl/15730) -os/exec: ExitError includes stderr (https://golang.org/cl/11415) -path/filepath: EvalSymlinks changed (https://golang.org/cl/16192); possible bug (https://golang.org/issue/13582) -path/filepath: Join("c:", "a") now returns `c:a` instead of `c:\a` on windows (https://golang.org/cl/17470) -regexp: Copy method (https://golang.org/cl/16110) -runtime: GODEBUG=cgocheck=2 (https://golang.org/cl/16899) -runtime: only one goroutine in traceback (https://golang.org/cl/16512) maybe -runtime: best-effort detection of concurrent misuse of maps (https://golang.org/cl/17501) -sort: faster but different order (https://golang.org/cl/15688, https://golang.org/cl/17389) -strconv: QuoteToGraphic (https://golang.org/cl/14184/) -testing: pause test timer during t.Parallel (https://golang.org/cl/16989) -testing/quick: terminates for recursive types (https://golang.org/cl/13830) -text/template: ExecError (https://golang.org/cl/13957/) -text/template: trimming spaces (https://golang.org/cl/14391/) -text/template: Funcs check names (https://golang.org/cl/14562/) -text/template: IsTrue (https://golang.org/cl/14562/) -text/template: blocks and permit redefinition (https://golang.org/cl/14005) -time: reject invalid day of month in Parse (https://golang.org/cl/17710)