[インデックス 14933] ファイルの概要
このコミットは、Go言語の標準ライブラリのAPI定義ファイルである api/next.txt
を更新するものです。このファイルは、Goの次期リリースで導入される予定の新しいAPI要素(関数、型、メソッド、変数など)を記録しており、GoのAPI互換性ポリシーに則って管理されています。
コミット
commit 1debf5bbd372592bca0294b6c6f0e7ee09f9928c
Author: Russ Cox <rsc@golang.org>
Date: Fri Jan 18 17:57:07 2013 -0500
api: update next.txt
R=golang-dev, minux.ma, dave
CC=golang-dev
https://golang.org/cl/7135061
GitHub上でのコミットページへのリンク
https://github.com/golang/go/commit/1debf5bbd372592bca0294b6c6f0e7ee09f9928c
元コミット内容
このコミットは、api/next.txt
ファイルを更新し、Go言語の次期リリースで導入される予定のAPI変更を反映しています。具体的には、go/doc
パッケージの Example
構造体への EmptyOutput
フィールドの追加、go/types
パッケージにおける大幅なAPIの再設計と追加、net
パッケージの ListenUnixgram
関数、net/smtp
パッケージの Client.Hello
メソッド、syscall
パッケージにおけるLinuxおよびWindows固有のシステムコール関連の追加、testing
パッケージの B.ReportAllocs
メソッド、time
パッケージの Timer.Reset
メソッドなどが含まれています。
変更の背景
Go言語は、後方互換性を非常に重視しており、既存のコードが新しいバージョンでも動作することを保証しています。この互換性ポリシーを維持するため、Goプロジェクトでは、新しいAPI要素や既存APIの変更を api/next.txt
のようなファイルに記録し、レビュープロセスを経て承認しています。このコミットは、Goの型システムを扱う go/types
パッケージの内部構造の改善、ドキュメンテーション生成の強化、ネットワーク機能の拡張、および特定のOSにおけるシステムコールへのアクセス改善など、様々な機能強化とバグ修正に伴うAPIの変更を反映するために行われました。特に go/types
パッケージの変更は、Goコンパイラの型チェック機能の基盤を強化し、より堅牢で柔軟な型システムを提供することを目的としています。
前提知識の解説
api/next.txt
: Go言語の標準ライブラリのAPI変更を記録するファイルです。Goのリリースサイクルにおいて、このファイルに記載されたAPIのみが次期リリースで利用可能となり、互換性が保証されます。go/types
パッケージ: Go言語のコンパイラが型チェックを行う際に使用するパッケージです。Goのプログラムの抽象構文木(AST)を解析し、各要素の型情報を解決し、型エラーを検出する役割を担います。このパッケージは、Goの型システムをプログラム的に表現するための主要なインターフェースと構造体を提供します。go/ast
パッケージ: Go言語のソースコードを抽象構文木(AST: Abstract Syntax Tree)として表現するためのパッケージです。コンパイラやツールがGoのコードを解析する際に利用されます。go/doc
パッケージ: Goのソースコードからドキュメンテーションを生成するためのパッケージです。go doc
コマンドやgodocサーバーがこのパッケージを利用して、コードコメントやExample関数からドキュメントを生成します。net
パッケージ: ネットワークI/O機能を提供するGoの標準パッケージです。TCP/IP、UDP、Unixドメインソケットなど、様々なネットワークプロトコルをサポートします。net/smtp
パッケージ: SMTP(Simple Mail Transfer Protocol)クライアントを実装するためのパッケージです。メールの送信機能を提供します。syscall
パッケージ: オペレーティングシステム固有のシステムコールへの低レベルなアクセスを提供するパッケージです。OSの機能に直接アクセスする必要がある場合に使用されます。testing
パッケージ: Goのテストフレームワークを提供するパッケージです。ユニットテスト、ベンチマークテストなどを記述するために使用されます。time
パッケージ: 時間の測定と表示のための機能を提供するパッケージです。
技術的詳細
このコミットの主要な変更点は、go/types
パッケージの大規模な改修です。
-
go/types
パッケージの再設計:Check
関数のシグネチャ変更: 以前はmap[string]*ast.File
を引数に取っていましたが、[]*ast.File
に変更されました。これは、型チェックの対象となるファイルの指定方法がより柔軟になったことを示唆しています。GcImport
およびGcImportData
関数のシグネチャ変更:map[string]*ast.Object
を引数に取っていた部分がmap[string]*Package
に変更されました。これは、Goコンパイラの内部的なパッケージインポートメカニズムが、より抽象的なPackage
型を扱うように変更されたことを意味します。- 新しい型とインターフェースの導入:
Const
,Func
,Package
,QualifiedName
,Scope
,TypeName
,Var
といった新しい構造体が導入され、Goの型システムにおける定数、関数、パッケージ、修飾名、スコープ、型名、変数といった概念をより明確に表現できるようになりました。Object
インターフェースが導入され、GetName()
,GetPos()
,GetType()
といった共通のメソッドを持つことで、これらの型システムオブジェクトを統一的に扱えるようになりました。Importer
型が導入され、パッケージのインポート処理を抽象化できるようになりました。
- 既存構造体の変更:
Context
,Field
,Method
,NamedType
,Result
,Signature
などの既存の構造体も、新しい型システムに合わせてフィールドの型が変更されたり、新しいフィールドが追加されたりしています。例えば、Field
やMethod
にembedded QualifiedName
が追加され、名前解決の仕組みが強化されています。 Universe
とUnsafe
変数の型変更:Universe
は*ast.Scope
から*Scope
に、Unsafe
は*ast.Object
から*Package
に変更されました。これは、go/types
パッケージがgo/ast
パッケージの具体的な型に依存する度合いを減らし、自身の型システムオブジェクトで完結するように設計が変更されたことを示しています。
-
go/doc
パッケージの拡張:Example
構造体にEmptyOutput bool
フィールドが追加されました。これは、Example関数の出力が空であるかどうかを示すために使用され、ドキュメンテーション生成時にExampleの表示をより適切に制御できるようになります。
-
ネットワーク機能の追加:
pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)
: Unixドメインデータグラムソケットをリッスンするための関数が追加されました。これにより、プロセス間通信の選択肢が広がります。pkg net/smtp, method (*Client) Hello(string) error
: SMTPクライアントがサーバーにHELO/EHLOコマンドを送信するためのメソッドが追加されました。SMTPセッションの開始時にサーバーに自身を識別させるために使用されます。
-
システムコールへのアクセス拡張:
- Linux:
pkg syscall (linux-...), func Pipe2([]int, int) error
が追加されました。これは、Linux固有のpipe2
システムコールへのバインディングで、パイプを作成する際にフラグを指定できるようになります(例:O_CLOEXEC
)。 - Windows:
IOC_IN
,IOC_INOUT
,IOC_OUT
,IOC_WS2
,SIO_GET_EXTENSION_FUNCTION_POINTER
,SO_UPDATE_CONNECT_CONTEXT
といった定数が追加されました。これらはWindowsソケット(Winsock2)のI/O制御コードやオプションに関連するものです。func ConnectEx(Handle, Sockaddr, *byte, uint32, *uint32, *Overlapped) error
およびfunc LoadConnectEx() error
が追加されました。ConnectEx
はWinsock2の拡張関数で、非同期接続を効率的に行うために使用されます。type GUID struct
とvar WSAID_CONNECTEX GUID
が追加されました。GUID
はWindowsでCOMインターフェースなどを識別するために使用されるグローバル一意識別子で、WSAID_CONNECTEX
はConnectEx
関数のGUIDです。
- Linux:
-
テスト機能の拡張:
pkg testing, method (*B) ReportAllocs()
: ベンチマークテストにおいて、メモリ割り当てに関する詳細なレポートを生成するためのメソッドが追加されました。パフォーマンスチューニングに役立ちます。
-
時間管理機能の拡張:
pkg time, method (*Timer) Reset(Duration) bool
: 既存のTimer
を新しい期間でリセットするためのメソッドが追加されました。これにより、タイマーを再利用する際の効率が向上します。
これらの変更は、Go言語の標準ライブラリが進化し、より強力で柔軟な機能を提供するための継続的な取り組みの一環です。特に go/types
パッケージの改修は、Goのコンパイラとツールチェーンの基盤を強化する上で重要な意味を持ちます。
コアとなるコードの変更箇所
このコミットは api/next.txt
ファイルのみを変更しています。このファイルは、GoのAPI互換性チェックツールによって使用されるAPIのリストであり、実際のGoのソースコードではありません。したがって、このコミット自体がGoのランタイムやコンパイラの動作を変更するものではなく、次期リリースで導入されるAPIの「宣言」を更新するものです。
変更の差分は以下の通りです。
--- a/api/next.txt
+++ b/api/next.txt
@@ -67,14 +67,34 @@ pkg go/ast, type CommentMap map[Node][]*CommentGroup
pkg go/build, type Context struct, InstallTag string
pkg go/build, type Package struct, SwigCXXFiles []string
pkg go/build, type Package struct, SwigFiles []string
+pkg go/doc, type Example struct, EmptyOutput bool
pkg go/doc, type Example struct, Play *ast.File
pkg go/doc, var IllegalPrefixes []string
pkg go/format, func Node(io.Writer, *token.FileSet, interface{}) error
@@ -110,14 +111,34 @@ pkg go/types, const UntypedInt BasicKind
pkg go/types, const UntypedNil BasicKind
pkg go/types, const UntypedRune BasicKind
pkg go/types, const UntypedString BasicKind
-pkg go/types, func Check(*token.FileSet, map[string]*ast.File) (*ast.Package, error)
+pkg go/types, func Check(*token.FileSet, []*ast.File) (*Package, error)
pkg go/types, func FindGcExportData(*bufio.Reader) error
pkg go/types, func FindPkg(string, string) (string, string)
-pkg go/types, func GcImport(map[string]*ast.Object, string) (*ast.Object, error)
-pkg go/types, func GcImportData(map[string]*ast.Object, string, string, *bufio.Reader) (*ast.Object, error)
-pkg go/types, method (*Context) Check(*token.FileSet, map[string]*ast.File) (*ast.Package, error)
+pkg go/types, func GcImport(map[string]*Package, string) (*Package, error)
+pkg go/types, func GcImportData(map[string]*Package, string, string, *bufio.Reader) (*Package, error)
+pkg go/types, method (*Const) GetName() string
+pkg go/types, method (*Const) GetPos() token.Pos
+pkg go/types, method (*Const) GetType() Type
+pkg go/types, method (*Context) Check(*token.FileSet, []*ast.File) (*Package, error)
+pkg go/types, method (*Func) GetName() string
+pkg go/types, method (*Func) GetPos() token.Pos
+pkg go/types, method (*Func) GetType() Type
+pkg go/types, method (*Package) GetName() string
+pkg go/types, method (*Package) GetPos() token.Pos
+pkg go/types, method (*Package) GetType() Type
+pkg go/types, method (*Scope) Insert(Object) Object
+pkg go/types, method (*Scope) Lookup(string) Object
+pkg go/types, method (*TypeName) GetName() string
+pkg go/types, method (*TypeName) GetPos() token.Pos
+pkg go/types, method (*TypeName) GetType() Type
+pkg go/types, method (*Var) GetName() string
+pkg go/types, method (*Var) GetPos() token.Pos
+pkg go/types, method (*Var) GetType() Type
pkg go/types, method (Complex) String() string
+pkg go/types, method (Field) IsSame(QualifiedName) bool
+pkg go/types, method (Method) IsSame(QualifiedName) bool
pkg go/types, method (NilType) String() string
+pkg go/types, method (QualifiedName) IsSame(QualifiedName) bool
pkg go/types, type Array struct
pkg go/types, type Array struct, Elt Type
pkg go/types, type Array struct, Len int64
@@ -134,47 +155,79 @@ pkg go/types, type Chan struct, Elt Type
pkg go/types, type Complex struct
pkg go/types, type Complex struct, Im *big.Rat
pkg go/types, type Complex struct, Re *big.Rat
+pkg go/types, type Const struct
+pkg go/types, type Const struct, Name string
+pkg go/types, type Const struct, Type Type
+pkg go/types, type Const struct, Val interface{}
pkg go/types, type Context struct
pkg go/types, type Context struct, Error func(error)
pkg go/types, type Context struct, Expr func(ast.Expr, Type, interface{})
-pkg go/types, type Context struct, Import ast.Importer
+pkg go/types, type Context struct, Ident func(*ast.Ident, Object)
+pkg go/types, type Context struct, Import Importer
pkg go/types, type Context struct, IntSize int64
pkg go/types, type Context struct, PtrSize int64
pkg go/types, type Field struct
pkg go/types, type Field struct, IsAnonymous bool
-pkg go/types, type Field struct, Name string
pkg go/types, type Field struct, Tag string
pkg go/types, type Field struct, Type Type
+pkg go/types, type Field struct, embedded QualifiedName
+pkg go/types, type Func struct
+pkg go/types, type Func struct, Name string
+pkg go/types, type Func struct, Type Type
+pkg go/types, type Importer func(imports map[string]*Package, path string) (pkg *Package, err error)
pkg go/types, type Interface struct
pkg go/types, type Interface struct, Methods []*Method
pkg go/types, type Map struct
pkg go/types, type Map struct, Elt Type
pkg go/types, type Map struct, Key Type
pkg go/types, type Method struct
-pkg go/types, type Method struct, Name string
pkg go/types, type Method struct, Type *Signature
+pkg go/types, type Method struct, embedded QualifiedName
pkg go/types, type NamedType struct
-pkg go/types, type NamedType struct, Obj *ast.Object
+pkg go/types, type NamedType struct, Methods []*Method
+pkg go/types, type NamedType struct, Obj *TypeName
pkg go/types, type NamedType struct, Underlying Type
pkg go/types, type NilType struct
+pkg go/types, type Object interface, GetName() string
+pkg go/types, type Object interface, GetPos() token.Pos
+pkg go/types, type Object interface, GetType() Type
+pkg go/types, type Object interface, unexported methods
+pkg go/types, type Package struct
+pkg go/types, type Package struct, Complete bool
+pkg go/types, type Package struct, Imports map[string]*Package
+pkg go/types, type Package struct, Name string
+pkg go/types, type Package struct, Path string
+pkg go/types, type Package struct, Scope *Scope
pkg go/types, type Pointer struct
pkg go/types, type Pointer struct, Base Type
+pkg go/types, type QualifiedName struct
+pkg go/types, type QualifiedName struct, Name string
+pkg go/types, type QualifiedName struct, Pkg *Package
pkg go/types, type Result struct
-pkg go/types, type Result struct, Values []*ast.Object
+pkg go/types, type Result struct, Values []*Var
+pkg go/types, type Scope struct
+pkg go/types, type Scope struct, Entries []Object
+pkg go/types, type Scope struct, Outer *Scope
pkg go/types, type Signature struct
pkg go/types, type Signature struct, IsVariadic bool
-pkg go/types, type Signature struct, Params []*ast.Object
-pkg go/types, type Signature struct, Recv *ast.Object
-pkg go/types, type Signature struct, Results []*ast.Object
+pkg go/types, type Signature struct, Params []*Var
+pkg go/types, type Signature struct, Recv *Var
+pkg go/types, type Signature struct, Results []*Var
pkg go/types, type Slice struct
pkg go/types, type Slice struct, Elt Type
pkg go/types, type Struct struct
pkg go/types, type Struct struct, Fields []*Field
pkg go/types, type Type interface, unexported methods
+pkg go/types, type TypeName struct
+pkg go/types, type TypeName struct, Name string
+pkg go/types, type TypeName struct, Type Type
+pkg go/types, type Var struct
+pkg go/types, type Var struct, Name string
+pkg go/types, type Var struct, Type Type
pkg go/types, var Default Context
pkg go/types, var Typ [...]*Basic
-pkg go/types, var Universe *ast.Scope
-pkg go/types, var Unsafe *ast.Object
+pkg go/types, var Universe *Scope
+pkg go/types, var Unsafe *Package
pkg image, const YCbCrSubsampleRatio440 YCbCrSubsampleRatio
pkg io, type ByteWriter interface { WriteByte }
pkg io, type ByteWriter interface, WriteByte(byte) error
@@ -403,6 +456,7 @@ pkg math/big, method (*Int) SetUint64(uint64) *Int
pkg math/big, method (*Int) Uint64() uint64
pkg math/big, method (*Int) UnmarshalJSON([]byte) error
pkg mime/multipart, method (*Writer) SetBoundary(string) error
+pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)
pkg net, func LookupNS(string) ([]*NS, error)
pkg net, method (*IPConn) ReadMsgIP([]byte, []byte) (int, int, int, *IPAddr, error)
pkg net, method (*IPConn) WriteMsgIP([]byte, []byte, *IPAddr) (int, int, error)
@@ -424,6 +478,7 @@ pkg net/http, type CloseNotifier interface, CloseNotify() <-chan bool
pkg net/http, type Request struct, PostForm url.Values
pkg net/mail, func ParseAddress(string) (*Address, error)
pkg net/mail, func ParseAddressList(string) ([]*Address, error)
+pkg net/smtp, method (*Client) Hello(string) error
pkg net/textproto, func TrimBytes([]byte) []byte
pkg net/textproto, func TrimString(string) string
pkg os, method (FileMode) IsRegular() bool
@@ -888,6 +943,7 @@ pkg syscall (freebsd-amd64), func Syscall9(uintptr, uintptr, uintptr, uintptr, u
pkg syscall (linux-386), func GetsockoptUcred(int, int, int) (*Ucred, error)
pkg syscall (linux-386), func Getxattr(string, string, []byte) (int, error)
pkg syscall (linux-386), func Listxattr(string, []byte) (int, error)
+pkg syscall (linux-386), func Pipe2([]int, int) error
pkg syscall (linux-386), func PtraceSyscall(int, int) error
pkg syscall (linux-386), func Removexattr(string, string) error
pkg syscall (linux-386), func Setxattr(string, string, []byte, int) error
@@ -896,6 +952,7 @@ pkg syscall (linux-386-cgo), func GetsockoptUcred(int, int, int) (*Ucred, error)
pkg syscall (linux-386-cgo), func Getxattr(string, string, []byte) (int, error)
pkg syscall (linux-386-cgo), func Listxattr(string, []byte) (int, error)
+pkg syscall (linux-386-cgo), func Pipe2([]int, int) error
pkg syscall (linux-386-cgo), func PtraceSyscall(int, int) error
pkg syscall (linux-386-cgo), func Removexattr(string, string) error
pkg syscall (linux-386-cgo), func Setxattr(string, string, []byte, int) error
@@ -905,6 +962,7 @@ pkg syscall (linux-amd64), const SizeofTCPInfo ideal-int
pkg syscall (linux-amd64), func GetsockoptUcred(int, int, int) (*Ucred, error)
pkg syscall (linux-amd64), func Getxattr(string, string, []byte) (int, error)
pkg syscall (linux-amd64), func Listxattr(string, []byte) (int, error)
+pkg syscall (linux-amd64), func Pipe2([]int, int) error
pkg syscall (linux-amd64), func PtraceSyscall(int, int) error
pkg syscall (linux-amd64), func Removexattr(string, string) error
pkg syscall (linux-amd64), func Setxattr(string, string, []byte, int) error
@@ -946,6 +1004,7 @@ pkg syscall (linux-amd64-cgo), const SizeofTCPInfo ideal-int
pkg syscall (linux-amd64-cgo), func GetsockoptUcred(int, int, int) (*Ucred, error)
pkg syscall (linux-amd64-cgo), func Getxattr(string, string, []byte) (int, error)
pkg syscall (linux-amd64-cgo), func Listxattr(string, []byte) (int, error)
+pkg syscall (linux-amd64-cgo), func Pipe2([]int, int) error
pkg syscall (linux-amd64-cgo), func PtraceSyscall(int, int) error
pkg syscall (linux-amd64-cgo), func Removexattr(string, string) error
pkg syscall (linux-amd64-cgo), func Setxattr(string, string, []byte, int) error
@@ -986,6 +1045,7 @@ pkg syscall (linux-amd64-cgo), type TCPInfo struct, Unacked uint32
pkg syscall (linux-arm), func GetsockoptUcred(int, int, int) (*Ucred, error)
pkg syscall (linux-arm), func Getxattr(string, string, []byte) (int, error)
pkg syscall (linux-arm), func Listxattr(string, []byte) (int, error)
+pkg syscall (linux-arm), func Pipe2([]int, int) error
pkg syscall (linux-arm), func PtraceSyscall(int, int) error
pkg syscall (linux-arm), func Removexattr(string, string) error
pkg syscall (linux-arm), func Setxattr(string, string, []byte, int) error
@@ -998,12 +1058,20 @@ pkg syscall (windows-386), const CREATE_NEW_PROCESS_GROUP ideal-int
pkg syscall (windows-386), const CTRL_BREAK_EVENT ideal-int
pkg syscall (windows-386), const CTRL_C_EVENT ideal-int
pkg syscall (windows-386), const ERROR_NOT_FOUND Errno
+pkg syscall (windows-386), const IOC_IN ideal-int
+pkg syscall (windows-386), const IOC_INOUT ideal-int
+pkg syscall (windows-386), const IOC_OUT ideal-int
+pkg syscall (windows-386), const IOC_WS2 ideal-int
+pkg syscall (windows-386), const SIO_GET_EXTENSION_FUNCTION_POINTER ideal-int
+pkg syscall (windows-386), const SO_UPDATE_CONNECT_CONTEXT ideal-int
pkg syscall (windows-386), func CancelIoEx(Handle, *Overlapped) error
+pkg syscall (windows-386), func ConnectEx(Handle, Sockaddr, *byte, uint32, *uint32, *Overlapped) error
pkg syscall (windows-386), func FreeAddrInfoW(*AddrinfoW)\n pkg syscall (windows-386), func GetAddrInfoW(*uint16, *uint16, *AddrinfoW, **AddrinfoW) error
pkg syscall (windows-386), func GetConsoleMode(Handle, *uint32) error
pkg syscall (windows-386), func Getsockopt(Handle, int32, int32, *byte, *int32) error
pkg syscall (windows-386), func LoadCancelIoEx() error
+pkg syscall (windows-386), func LoadConnectEx() error
pkg syscall (windows-386), func LoadGetAddrInfo() error
pkg syscall (windows-386), func UTF16FromString(string) ([]uint16, error)
pkg syscall (windows-386), func UTF16PtrFromString(string) (*uint16, error)
@@ -1017,8 +1085,14 @@ pkg syscall (windows-386), type AddrinfoW struct, Flags int32
pkg syscall (windows-386), type AddrinfoW struct, Next *AddrinfoW
pkg syscall (windows-386), type AddrinfoW struct, Protocol int32
pkg syscall (windows-386), type AddrinfoW struct, Socktype int32
+pkg syscall (windows-386), type GUID struct
+pkg syscall (windows-386), type GUID struct, Data1 uint32
+pkg syscall (windows-386), type GUID struct, Data2 uint16
+pkg syscall (windows-386), type GUID struct, Data3 uint16
+pkg syscall (windows-386), type GUID struct, Data4 [8]byte
pkg syscall (windows-386), type RawSockaddrInet6 struct, Family uint16
pkg syscall (windows-386), type SysProcAttr struct, CreationFlags uint32
+pkg syscall (windows-386), var WSAID_CONNECTEX GUID
pkg syscall (windows-amd64), const AI_CANONNAME ideal-int
pkg syscall (windows-amd64), const AI_NUMERICHOST ideal-int
pkg syscall (windows-amd64), const AI_PASSIVE ideal-int
@@ -1026,12 +1100,20 @@ pkg syscall (windows-amd64), const CREATE_NEW_PROCESS_GROUP ideal-int
pkg syscall (windows-amd64), const CTRL_BREAK_EVENT ideal-int
pkg syscall (windows-amd64), const CTRL_C_EVENT ideal-int
pkg syscall (windows-amd64), const ERROR_NOT_FOUND Errno
+pkg syscall (windows-amd64), const IOC_IN ideal-int
+pkg syscall (windows-amd64), const IOC_INOUT ideal-int
+pkg syscall (windows-amd64), const IOC_OUT ideal-int
+pkg syscall (windows-amd64), const IOC_WS2 ideal-int
+pkg syscall (windows-amd64), const SIO_GET_EXTENSION_FUNCTION_POINTER ideal-int
+pkg syscall (windows-amd64), const SO_UPDATE_CONNECT_CONTEXT ideal-int
pkg syscall (windows-amd64), func CancelIoEx(Handle, *Overlapped) error
+pkg syscall (windows-amd64), func ConnectEx(Handle, Sockaddr, *byte, uint32, *uint32, *Overlapped) error
pkg syscall (windows-amd64), func FreeAddrInfoW(*AddrinfoW)
pkg syscall (windows-amd64), func GetAddrInfoW(*uint16, *uint16, *AddrinfoW, **AddrinfoW) error
pkg syscall (windows-amd64), func GetConsoleMode(Handle, *uint32) error
pkg syscall (windows-amd64), func Getsockopt(Handle, int32, int32, *byte, *int32) error
pkg syscall (windows-amd64), func LoadCancelIoEx() error
+pkg syscall (windows-amd64), func LoadConnectEx() error
pkg syscall (windows-amd64), func LoadGetAddrInfo() error
pkg syscall (windows-amd64), func UTF16FromString(string) ([]uint16, error)
pkg syscall (windows-amd64), func UTF16PtrFromString(string) (*uint16, error)
@@ -1045,8 +1127,14 @@ pkg syscall (windows-amd64), type AddrinfoW struct, Flags int32
pkg syscall (windows-amd64), type AddrinfoW struct, Next *AddrinfoW
pkg syscall (windows-amd64), type AddrinfoW struct, Protocol int32
pkg syscall (windows-amd64), type AddrinfoW struct, Socktype int32
+pkg syscall (windows-amd64), type GUID struct
+pkg syscall (windows-amd64), type GUID struct, Data1 uint32
+pkg syscall (windows-amd64), type GUID struct, Data2 uint16
+pkg syscall (windows-amd64), type GUID struct, Data3 uint16
+pkg syscall (windows-amd64), type GUID struct, Data4 [8]byte
pkg syscall (windows-amd64), type RawSockaddrInet6 struct, Family uint16
pkg syscall (windows-amd64), type SysProcAttr struct, CreationFlags uint32
+pkg syscall (windows-amd64), var WSAID_CONNECTEX GUID
pkg syscall, func BytePtrFromString(string) (*byte, error)
pkg syscall, func ByteSliceFromString(string) ([]byte, error)
pkg syscall, func NsecToTimespec(int64) Timespec
@@ -1058,6 +1146,7 @@ pkg syscall, type RawSockaddrInet6 struct, Flowinfo uint32
pkg syscall, type RawSockaddrInet6 struct, Port uint16
pkg syscall, type RawSockaddrInet6 struct, Scope_id uint32
pkg testing, func Verbose() bool
+pkg testing, method (*B) ReportAllocs()
pkg testing, method (BenchmarkResult) AllocedBytesPerOp() int64
pkg testing, method (BenchmarkResult) AllocsPerOp() int64
pkg testing, method (BenchmarkResult) MemString() string
@@ -1120,6 +1209,7 @@ pkg text/template/parse, type TemplateNode struct, embedded Pos
pkg text/template/parse, type TextNode struct, embedded Pos
pkg text/template/parse, type Tree struct, ParseName string
pkg text/template/parse, type VariableNode struct, embedded Pos
+pkg time, method (*Timer) Reset(Duration) bool
pkg time, method (Time) Round(Duration) Time
pkg time, method (Time) Truncate(Duration) Time
pkg time, method (Time) YearDay() int
コアとなるコードの解説
このコミットは、GoのAPI定義ファイルである api/next.txt
のみを変更しており、実際のGoのソースコードの変更は含まれていません。しかし、このファイルに記載された変更は、Goの次期リリースで導入される実際のコード変更を反映しています。
特に注目すべきは go/types
パッケージに関する変更です。これは、Goコンパイラの型チェック部分の内部構造が大幅に再設計されたことを示唆しています。
go/types
の型システムオブジェクトの抽象化: 以前はgo/ast
パッケージの*ast.Object
や*ast.Scope
といったAST固有の型に依存していましたが、新しいConst
,Func
,Package
,TypeName
,Var
,Scope
といった独自の型システムオブジェクトを導入し、これらを統一的に扱うObject
インターフェースを定義しています。これにより、go/types
パッケージはASTの具体的な表現から独立し、より汎用的な型システムを構築できるようになります。これは、コンパイラのモジュール性や保守性を向上させる上で非常に重要です。Check
関数の柔軟性向上:Check
関数の引数がmap[string]*ast.File
から[]*ast.File
に変更されたことで、型チェックの対象となるファイルの指定がよりシンプルかつ柔軟になりました。GcImport
関連関数の改善:GcImport
およびGcImportData
関数が*Package
型を扱うようになったことで、Goコンパイラの内部的なパッケージインポート処理が、より高レベルな抽象化の下で行われるようになりました。Field
とMethod
のQualifiedName
埋め込み:Field
とMethod
構造体にembedded QualifiedName
が追加されたことは、フィールドやメソッドの名前解決が、パッケージ名を含む修飾名(Qualified Name)に基づいて行われるようになったことを示唆しています。これにより、異なるパッケージ間で同じ名前のフィールドやメソッドが存在する場合でも、正確な識別が可能になります。testing.B.ReportAllocs()
: ベンチマークテストにおいて、メモリ割り当ての詳細な情報を取得できるようになることで、開発者はより効果的にメモリ使用量を最適化できるようになります。time.Timer.Reset(Duration) bool
:time.Timer
の再利用を容易にし、タイマーを頻繁に作成・破棄する際のオーバーヘッドを削減します。
これらの変更は、Go言語のコンパイラ、ツール、および標準ライブラリの全体的な堅牢性、パフォーマンス、および使いやすさを向上させるための重要なステップです。
関連リンク
- Go言語の公式ドキュメント: https://golang.org/doc/
- Go言語のAPI互換性ポリシー: https://golang.org/doc/go1compat
- Goの型システムに関する議論(GoコミュニティのメーリングリストやIssueトラッカーで関連する議論が見つかる可能性があります)
参考にした情報源リンク
- Go言語のソースコードリポジトリ: https://github.com/golang/go
- Goのコードレビューシステム (Gerrit): https://go-review.googlesource.com/ (コミットメッセージに記載されている
https://golang.org/cl/7135061
はGerritの変更リストへのリンクです) - Goの各パッケージのドキュメント(例:
go/types
): https://pkg.go.dev/ (例: https://pkg.go.dev/go/types) - Goのリリースノート(該当するGoのバージョンがリリースされた際に、これらのAPI変更に関する詳細が記載されます)
- Goのブログ(特定の機能や変更に関する詳細な解説が投稿されることがあります)