😃

Go1.20リリースお知らせ記事を翻訳する(後編)

2023/02/08に公開

Outline

前編はこちらです。

https://zenn.dev/nii/articles/read-go-1-20-release-article

2023年2月1日にGo 1.20がリリースされ、The Go Blogにてリリース告知の記事が投稿されました。
本記事ではブログの翻訳を記載します。誤訳等や読みづらい点がありましたらコメント/Githubのissueにご連絡いただけると幸いです。

https://go.dev/blog/go1.20

Go 1.20の詳細な機能説明に関しては、リリース告知ではなくリリースノートをご覧ください。
https://go.dev/doc/go1.20

Index

前編(前回記事)

  • Go 1.20がリリースされました!
  • 言語の変更
  • ツールの改善

後編(本記事)

  • 標準ライブラリの追加
  • パフォーマンスの向上
  • あとがき

標準ライブラリの追加

  • 新しいcrypto/ecdhパッケージは、NIST曲線とCurve25519を介した楕円曲線ディフィー・ヘルマン鍵共有を明示的にサポートします。
  • The new crypto/ecdh package provides explicit support for Elliptic Curve Diffie-Hellman key exchanges over NIST curves and Curve25519.

  • 新しい関数である errors.Join はエラーをラッピングしたリストを返します。これにより、もしエラータイプが Unwrap() []errorメソッドを実装していれば再度エラーを取得できるようになるかもしれません。
  • The new function errors.Join returns an error wrapping a list of errors which may be obtained again if the error type implements the Unwrap() []error method.

  • 新しい http.ResponseController 型は、http.ResponseWriterインターフェースでは扱えなかった、HTTPリクエスト毎に制御できる拡張された機能を提供します。
  • The new http.ResponseController type provides access to extended per-request functionality not handled by the http.ResponseWriter interface.

  • httputil.ReverseProxyのフォワードプロキシには、前のDirectorフックに取って代わって新しいRewriteフック関数が含まれるようになりました。
  • The httputil.ReverseProxy forwarding proxy includes a new Rewrite hook function, superseding the previous Director hook.

  • 新しい context.WithCancelCause 関数は、与えられたエラーと共にコンテクストをキャンセルする手法を提供します。このエラーは、新関数であるcontext.Causeを呼ぶことによって取得することができます。
  • The new context.WithCancelCause function provides a way to cancel a context with a given error. That error can be retrieved by calling the new context.Cause function.

  • 新しいos/exec.CmdフィールドのCancelWaitDelayは、関連づけられたContextがキャンセルかプロセスが終了した際の Cmd の振る舞いを明示します。
  • The new os/exec.Cmd fields Cancel and WaitDelay specify the behavior of the Cmd when its associated Context is canceled or its process exits.

パフォーマンスの向上

  • コンパイラとガベージコレクターはメモリのオーバーヘッドを減らし、全体的なCPU性能を2%向上させました。
  • Compiler and garbage collector improvements have reduced memory overhead and improved overall CPU performance by up to 2%.

  • 特にコンパイルをターゲットにする作業により、ビルドが10%程度早くなりました。これによって、Go1.17の時と同じ程度のスピードでビルドできます。
  • Work specifically targeting compilation times led to build improvements by up to 10%. This brings build speeds back in line with Go 1.17.

あとがき

Goリリースをソースからビルドする際、Go1.17.13より新しいバージョンが必要です。将来的にはbootstrap toolchainを約1年に1度改良します。

When building a Go release from source, Go 1.20 requires a Go 1.17.13 or newer release. In the future, we plan to move the bootstrap toolchain forward approximately once a year.


また、Go1.21が始まる時、下記の古いOSはサポート外になります:

  • Windows 7,8
  • Windows Server 2008,2012
  • macOS 10.13(High Sierra), 10.14(Mojave)

一方で、RISC-Vで動くFreeBSD OSを実験的にサポートしています。

Also, starting with Go 1.21, some older operating systems will no longer be supported: this includes Windows 7, 8, Server 2008 and Server 2012, macOS 10.13 High Sierra, and 10.14 Mojave. On the other hand, Go 1.20 adds experimental support for FreeBSD on RISC-V.


詳細な変更点はリリースノートを参照してください。
https://go.dev/doc/go1.20

For a complete and more detailed list of all changes see the full release notes.


コードを書いてくださった方、バグをファイリングしてくださった方、フィードバックを送ってくださった方、そしてリリース候補版をテストしてくださったコントリビューターの皆様にお礼を申し上げます。

皆様の貢献により、Go 1.20を可能なかぎり安定させることができました。いつも通り、何か問題があればissueとして起票してください。

Thanks to everyone who contributed to this release by writing code, filing bugs, sharing feedback, and testing the release candidates. Your efforts helped to ensure that Go 1.20 is as stable as possible. As always, if you notice any problems, please file an issue.


Go 1.20を楽しんでください!

Enjoy Go 1.20!

GitHubで編集を提案

Discussion