Chewing Go 1.8

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

2017.02.16 Go released version 1.8, take the time to read and translate, if necessary, upgrade to a level. Start the first, lest you forget.

Panda 2017.03.19 11:20

Go 1.7 After the release of 6 months, go the latest version 1.8 will not. 1.8 of the changes are mostly to toolchain, runtime,libraries perfection; There are also minor changes in the 2 language specifications. This version, as usual, is backwards compatible.

Adds support for 32-bit MIPS, updates the compiler back end to generate more efficient code, reduces GC pauses by eliminat ing Stop-the-world stack rescanning,adds http/2 Push support, adds HTTP graceful shutdown, adds more context Support,enabl ES profiling mutexes, and simplifies sorting slices.

To tell the truth, the first sentence did not read too much.

Added support for HTTP/2 server push, which can be referenced in http://www.open-open.com/lib/view/open1483537725037.html (HTTP2 Server Push Research)

Added an HTTP graceful shutdown

Added more context support

The Profiling muteness is enabled

Simplified sorting of slices

    • The change of changes to Language language

When you explicitly want to convert a value from a struct to another struct, 1.8 ignores tags;

The difference between the two structures in the graph is that the tag of x is not the same, so it can be converted directly.

    • Func example () {        type T1 struct {                x int ' json: ' foo ' '        }        type T2 struct {                x int ' json: "Bar" '        }        V AR v1 T1        var v2 T2        v1 = T1 (v2)//Now legal}
    • Ports

Go 1.8 only supports OS X 10.8 or newer.

Go 1.8 will be the last version to support the Linux operating system on armv5e and ARMV6. Go 1.9 will require armv6k or update. Verify that a Linux system is not armv6k or updated to perform

> Go Tool dist-check-armv6k

Go 1.8 is somewhat unstable on FreeBSD and NetBSD, and has not yet been found, and in a few cases may cause the program to hang up directly. Refer to issues:https://golang.org/issue/15658 https://golang.org/issue/16511 eagerly looking forward to any help in solving these problems.

    • Runtime
      • Concurrent Map Issue

Go 1.8 improves the concurrent problem of detecting map by reading and writing a map at the same time through the detection program

Normally, if a goroutine is writing a map, there should be no other grouting reading or writing this map at the same time. If runtime detects this condition, the diagnostic information is printed and crash. The best way to find this problem is to run the program in race detector mode, for race detector can refer to: https://blog.golang.org/race-detector

    • Memstats

In order to make the program run faster, it accelerates garbage collection and optimizes some of the standard libraries

There has been optimizations to implementations in bytes the, crypto/aes crypto/cipher crypto/elliptic crypto/sha256 crypto/sha512 encoding/asn1 encoding/csv encoding/hex encoding/json ,,,,,,,, ,,,,,,,,,,,,,, and hash/crc32 image/color image/draw math math/big reflect regexp runtime strconv strings syscall text/template unicode/utf8 packages.

    • Sort

The sort package is easier to use, and in most cases you don't have to write structs to implement the sort interface.

    • HTTP/2 Push

The Net/http package adds a mechanism for sending HTTP/2 server pushes from handler. Compared to the existing flusher and hijacker interfaces, HTTP/2 's responsewriter perfected the new pusher interface.

    • More Context Support

Following go 1.7 will be the context. After the context has been put into the standard library, Go1.8 has added more context

    • Mutex contention Profiling

Most users will want to use go test-mutexprofile and then use proof to analyze the results.

Lower-level support is also available via the new MutexProfile and SetMutexProfileFraction .


A known limitation of Go 1.8 is that the mutex profile analysis is only for sync. Mutext, not for sync. Rwmutex

    • Archive/tar

The TAR package corrects a number of minor side-corner bugs, and Reader can now handle the >8GB tar file for pax format. Writer no longer produces invalid tar files in the case of long parameters.

    • Compress/flate
    • Compress/gzip
    • Context
    • Crypto/tls This is HTTPS-related, with relatively little
    • crypto/x509 Support for PSS signature
    • Database/sql this needs to be tested, it seems to be enough now.
    • Debug/pe don't know what to do ...
    • Encoding/base64 added the Encoding.strict method
    • Encoding/binary Read and write support Booleans
    • Encoding/json

Unmarshaltypeerror contains the struct and filed names

Nil will be encode into JSON null

    • Encoding/pem decode more stringent on the end line
    • Encoding/xml
    • Expvar added the method of value, usage reference: https://my.oschina.net/moooofly/blog/826460
    • FMT scanf, fscanf, sscanf processing space is not the same as before.
    • Go/doc
    • Go/types
    • Html/template
    • Image/png
    • Math/big
    • Math/rand
    • Mime
    • Net
    • Net/http

Not to be continued ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.