implementing clean/eloquent APIs in Go. Options implemented as a function set the state of that option. FOPは、Goでクリーン/雄弁なAPIを実装するための方法です。 関数として実装されたオプションは、そのオプションの状態を設定します。 さきほどの例で示した aws-sdk-go でもこのパターンを使用しています。 client := s3.NewFromConfig(config, “us-east-1", true) client := s3.NewFromConfig(config, func(o *s3.Options) { o.Region = “us-east-1” o.DisableSSL = true } )
a complex object from its representation so that the same construction process can create different representations. BPは、複雑なオブジェクトの構築とその表現を分離し、同じ構築プロセスで異なる表現を作成できるようにします。 特徴としてはメソッドをチェーンした最後に Buildメソッドを呼び出すことです。 client := s3.NewFromConfig(config, “us-east-1", true) client := s3.NewFromConfig(config) .WithRegion(“us-east-1”) .WithDisableSSl(true) .Build()
function arguments and results using registers instead of the stack. Benchmarks for a representative set of Go packages and programs show performance improvements of about 5%, and a typical reduction in binary size of about 2%. Go 1.18 expands the supported platforms to include 64-bit ARM (GOARCH=arm64), big- and little-endian 64-bit PowerPC (GOARCH=ppc64, ppc64le), as well as 64-bit x86 architecture (GOARCH=amd64) on all operating systems. Go 1.17 は、スタックの代わりにレジスタを使用して関数の引数と結果を渡す新しい方法を実装しています 。代表 的な Go パッケージとプログラムのベンチマークでは、パフォーマンスが約 5% 向上し、バイナリ サイズが通常約 2% 削減されました。 Go 1.18 はサポートするプラットフォームを拡大し、 64 ビット ARM (GOARCH=arm64) とビッグ/リトルエンディア ンの 64 ビット PowerPC (GOARCH=ppc64, ppc64le) に加え、すべての OS 上の 64 ビット x86 アーキテクチャ (GOARCH=amd64) をサポートしました。