Go programming language 1.18 release

The release of the programming language Go 1.18 is presented, which is being developed by Google with the participation of the community as a hybrid solution that combines the high performance of compiled languages ​​with such advantages of scripting languages ​​as ease of writing code, speed of development, and error protection. The project code is distributed under the BSD license.

The syntax of Go is based on the familiar elements of the C language with some borrowings from the Python language. The language is quite concise, but the code is easy to read and understand. Go code is compiled into separate binary executable files that run natively without the use of a virtual machine (profiling, debugging, and other runtime problem detection subsystems are integrated as runtime components), which allows achieving performance comparable to C programs.

The project is initially developed with an eye on multi-threaded programming and efficient operation on multi-core systems, including providing means implemented at the operator level for organizing parallel computing and interaction between parallelly executed methods. The language also provides built-in protection against overruns of allocated memory blocks and provides the ability to use the garbage collector.

The new version adds support for generic functions and types (generics), with the help of which a developer can define and use functions designed to work with several types at once. It is also possible to use interfaces to create combined types that span multiple data types. Support for generics is implemented without breaking backward compatibility with existing code. // Sum set values, works for int64 and float64 types func SumIntsOrFloats[K comparable, V int64 | float64](m map[K]V) V { var s V for _, v := range m { s += v } return s } // Another option with a generic type definition: type Number interface { int64 | float64 } func SumNumbers[K comparable, V Number](m map[K]V) V { var s V for _, v := range m { s += v } return s }

Other improvements:

  • Utilities for fuzzing code testing are integrated into the standard toolkit. During fuzzing testing, a stream of all possible random combinations of input data is generated and possible failures during their processing are recorded. If a sequence crashes or does not match the expected response, then this behavior is highly likely to indicate a bug or vulnerability.
  • Added support for multi-modular workspaces, allowing you to execute commands on multiple modules at once, allowing you to simultaneously build and run code in multiple modules.
  • Significant performance optimizations have been made for systems based on Apple M1, ARM64 and PowerPC64 processors. Enabled the ability to use registers instead of the stack to pass arguments to functions and return the result. Improved inline unrolling of loops by the compiler. Type checking in the compiler has been completely redesigned. Some tests show a 20% increase in code performance compared to the previous release, but compilation itself takes about 15% longer.
  • In runtime, the efficiency of returning freed memory to the operating system has been increased and the operation of the garbage collector has been improved, the behavior of which has become more predictable.
  • New packages net/netip and debug/buildinfo have been added to the standard library. Support for TLS 1.0 and 1.1 is disabled by default in client code. The crypto/x509 module has stopped processing certificates signed using the SHA-1 hash.
  • The requirements for the environment in Linux have been raised; to work, you now need to have a Linux kernel of at least version 2.6.32. In the next release, similar changes are expected for FreeBSD (support for the FreeBSD 11.x branch will be discontinued) and at least FreeBSD 12.2 will be required to work.

Source: opennet.ru

Add a comment