Go 1.9 release
- Transfer
Today (translator's note: 24-08-2017), our team is pleased to present you the release of Go 1.9. You can download it from here . There are a lot of changes in this release regarding the language itself, standard libraries, ray time and ecosystem tools. In this post I will tell you about the most significant of them. The greatest effort in this release was made to improve the runtime and ecosystem tools, which makes the announcement less interesting, but the release is more magnificent.
The most important change in the language is aliases for types: a feature created for the gradual recovery of code. Type aliases are represented as follows:
This declaration creates an alias T1 for type T2, in the same way that byte is an alias for uint8 . The architecture of alice for types is described in the document , and the article on refactoring covers this topic in even more detail.
The new math / bits package provides counting and manipulation functions for unsigned integers using special CPU instructions where possible. For example: on x86-64 systems, bits.TrailingZeros (x) uses BSF instructions. New type Map added to sync
packageSecure for concurrent access (thread safe). You can read more about this in the type documentation and learn more about creating this type from the report at GopherCon 2017 ( slides ). Map is not a replacement for Go's built-in type of associative arrays; please read the relevant documentation for understanding and understanding for what purposes to use Map.
The testing package also received its portion of the supplement . A new Helper method has been added to testing.T and testing.Bmarking the called function as a test helper function. When a test package displays information about a file and a line, it shows the location of the auxiliary function call instead of showing the line in the auxiliary test function itself.
For example, consider the following test:
Since failure identifies itself as an auxiliary test function, error messages displayed during Test execution will point to line 11, where failure is called , instead of line 7, where failure calls t.Fatal .
The time package now transparently monitors “monotonous” time (translator's note: referring to the types of time provided by the OS) in the Time value , calculating the execution time between two calls (values) Timesafe operation, even in the presence of a regular OS clock (OS clock synchronization). For example, the following piece of code calculates the exact runtime, even if synchronization of a normal clock occurs within one second:
See the package documentation and documents to the design (architecture) for more information.
And finally, as part of the effort to make the Go compiler even faster, in Go 1.9 the functions inside the package are compiled competitively (simultaneously, simultaneously).
Go 1.9 includes many more new features, enhancements and fixes. You can see the full list of changes, as well as more detailed information about improvements in the Go 1.9 change list .
To celebrate the new release, the Go user community is hosting evening parties around the world for the release .
The most important change in the language is aliases for types: a feature created for the gradual recovery of code. Type aliases are represented as follows:
type T1 = T2
This declaration creates an alias T1 for type T2, in the same way that byte is an alias for uint8 . The architecture of alice for types is described in the document , and the article on refactoring covers this topic in even more detail.
The new math / bits package provides counting and manipulation functions for unsigned integers using special CPU instructions where possible. For example: on x86-64 systems, bits.TrailingZeros (x) uses BSF instructions. New type Map added to sync
packageSecure for concurrent access (thread safe). You can read more about this in the type documentation and learn more about creating this type from the report at GopherCon 2017 ( slides ). Map is not a replacement for Go's built-in type of associative arrays; please read the relevant documentation for understanding and understanding for what purposes to use Map.
The testing package also received its portion of the supplement . A new Helper method has been added to testing.T and testing.Bmarking the called function as a test helper function. When a test package displays information about a file and a line, it shows the location of the auxiliary function call instead of showing the line in the auxiliary test function itself.
For example, consider the following test:
package p
import "testing"
func failure(t *testing.T) {
t.Helper() // This call silences this function in error reports.
t.Fatal("failure")
}
func Test(t *testing.T) {
failure(t)
}
Since failure identifies itself as an auxiliary test function, error messages displayed during Test execution will point to line 11, where failure is called , instead of line 7, where failure calls t.Fatal .
The time package now transparently monitors “monotonous” time (translator's note: referring to the types of time provided by the OS) in the Time value , calculating the execution time between two calls (values) Timesafe operation, even in the presence of a regular OS clock (OS clock synchronization). For example, the following piece of code calculates the exact runtime, even if synchronization of a normal clock occurs within one second:
start := time.Now()
f()
elapsed := time.Since(start)
See the package documentation and documents to the design (architecture) for more information.
And finally, as part of the effort to make the Go compiler even faster, in Go 1.9 the functions inside the package are compiled competitively (simultaneously, simultaneously).
Go 1.9 includes many more new features, enhancements and fixes. You can see the full list of changes, as well as more detailed information about improvements in the Go 1.9 change list .
To celebrate the new release, the Go user community is hosting evening parties around the world for the release .