[インデックス 16197] ファイルの概要
このコミットでは、Go言語の公式ドキュメントファイルである doc/go1.1.html
、doc/go1.html
、および doc/reference.html
が変更されています。これらのファイルは、Go 1.1およびGo 1のリリースノートやリファレンスドキュメントの一部であり、主にドキュメント内の記述の微調整、新しいリンクの追加、および既存の壊れたリンクの修正が行われています。
コミット
- コミットハッシュ:
12566a60d789077bcaeb699879695060cae6f8c4
- Author: Brad Fitzpatrick bradfitz@golang.org
- Date: Thu Apr 18 12:43:23 2013 -0700
GitHub上でのコミットページへのリンク
https://github.com/golang/go/commit/12566a60d789077bcaeb699879695060cae6f8c4
元コミット内容
doc: misc tweaks, new links, fix broken links
I read docs and wrote a crawler + link checker on the plane,
which also checks for #fragments. I'll send that out later
when it's less gross.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8729050
変更の背景
このコミットの背景には、Go言語の公式ドキュメントの品質向上への取り組みがあります。コミットメッセージによると、作者のBrad Fitzpatrick氏は、飛行機内でドキュメントを読み込み、同時にリンクチェッカー(フラグメント、つまりページ内の特定セクションへのアンカーリンクもチェックする機能を持つ)を開発したと述べています。このツールを用いてドキュメント全体をスキャンし、壊れたリンクや不正確な記述を発見・修正した結果がこのコミットに反映されています。
特に、Go言語のような進化の速いプロジェクトでは、ドキュメントがコードの変更に追いつかず、情報が古くなったり、リンクが切れたりすることが頻繁に発生します。このような状況を防ぎ、ユーザーが常に正確で最新の情報にアクセスできるようにするため、定期的なドキュメントのレビューとメンテナンスが不可欠です。このコミットは、そのメンテナンス活動の一環として行われたものです。
前提知識の解説
このコミットの変更内容を理解するためには、以下のGo言語に関する基本的な知識が必要です。
- Go言語のドキュメント構造: Go言語の公式ドキュメントは、
golang.org/doc
以下に配置されており、リリースノート(例:go1.html
,go1.1.html
)、チュートリアル、リファレンスなどが含まれます。これらは通常HTML形式で提供されます。 go
コマンド: Go言語のビルド、テスト、実行、パッケージ管理などを行うための主要なコマンドラインツールです。go test
: Goパッケージのテストを実行するためのコマンドです。プロファイリング機能も提供します。go run
: Goソースファイルをコンパイルして実行するためのコマンドです。go get
: リモートリポジトリからGoパッケージをダウンロードし、インストールするためのコマンドです。
GOPATH
: Go 1.11以前のGo言語のワークスペースモデルにおいて、Goのソースコード、パッケージ、実行可能ファイルが配置されるディレクトリのパスを定義する環境変数です。go get
コマンドがパッケージをダウンロードする際のデフォルトの場所として使用されました。Go Modulesの導入により、その重要性は低下しましたが、古いプロジェクトや特定のビルド環境では依然として関連性があります。- Go Race Detector (競合検出器): Go 1.1で導入されたツールで、並行処理におけるデータ競合(複数のゴルーチンが同じ変数に同時にアクセスし、少なくとも1つが書き込みである場合に発生するバグ)を検出します。これは、並行プログラミングにおけるデバッグを大幅に支援する強力な機能です。
int
型のサイズ (64-bit architectures): Go言語のint
型は、実行環境のCPUアーキテクチャに依存して32ビットまたは64ビットのいずれかになります。64ビットアーキテクチャでは、int
型は64ビット幅を持ちます。crypto/x509
パッケージ: Go言語の標準ライブラリの一部で、X.509証明書とCRL(証明書失効リスト)の解析、生成、検証を扱うための機能を提供します。go/ast
パッケージ: Go言語のソースコードの抽象構文木(AST)を表現するためのパッケージです。Goのツール(例:go fmt
,go vet
)がコードを解析・変換する際に使用されます。os
パッケージ: オペレーティングシステムとのインタラクション(ファイルシステム操作、環境変数、プロセス管理など)を提供するGo言語の標準ライブラリパッケージです。os.ErrNotExist
は、ファイルやディレクトリが存在しないことを示すエラーです。- HTMLアンカー (
#fragments
): HTMLドキュメント内で、特定のセクションに直接リンクするためのメカニズムです。URLの末尾に#
とそのセクションのIDを追加することで、ブラウザはそのIDを持つ要素までスクロールします。
技術的詳細
このコミットで行われた技術的な変更は、主にGo言語の公式ドキュメントの正確性とユーザビリティの向上に焦点を当てています。
-
doc/go1.1.html
の変更点:- Heap size on 64-bit architectures: 64ビットアーキテクチャにおける最大ヒープサイズに関する記述が微修正されています。「On 64-bit architectures only」から「On 64-bit architectures」に変更され、より簡潔になっています。これは、64ビット環境でのヒープサイズ拡張が一般的な情報であることを強調しています。
- Race detector (競合検出器): 競合検出器の機能説明がより正確になっています。以前は「concurrent changes to the same variable」と記述されていましたが、より厳密に「concurrent access of the same variable, where at least one of the accesses is a write」と修正されました。これは、読み取り専用の同時アクセスはデータ競合ではないという、競合検出器の定義に合致するよう改善されたものです。
- The gc assemblers:
int
型の64ビット化と、新しい内部関数表現(http://golang.org/s/go11func
へのリンクが追加)により、gc
ツールチェーンにおけるスタック上の関数引数の配置が変更されたことに関する記述が追加されました。これにより、アセンブリで書かれた関数を修正する必要があることが明示されています。 go get
command andGOPATH
:go get
コマンドがGOPATH
を必須とするようになったことについて、GOPATH
の説明へのリンク(/doc/code.html#GOPATH
)が追加されました。これにより、ユーザーはGOPATH
の詳細を簡単に参照できるようになりました。- Changes to the
go test
command:- プロファイリング有効時にバイナリを削除しなくなったことについて、
go test
コマンドのドキュメントへのリンク(/cmd/go/#hdr-Test_packages
)が追加されました。 - ゴルーチンのブロックプロファイリング機能について、同様に
go test
コマンドのドキュメントへのリンクが追加されました。
- プロファイリング有効時にバイナリを削除しなくなったことについて、
- Changes to the
go run
command:go run
コマンドの動作変更(引数なしでカレントディレクトリの全ファイルを対象とする、テストファイルを指定するとエラーになるなど)について、go run
コマンドのドキュメントへのリンク(/cmd/go/#hdr-Compile_and_run_Go_program
)が追加されました。
-
doc/go1.html
の変更点:crypto/x509
パッケージの変更:CreateCertificate
関数とCreateCRL
関数(Go 1リリース時点)のシグネチャ変更に関する記述が修正されました。特にCreateCRL
が関数からCertificate
メソッドになったことを反映し、リンクもCreateCRL
からCertificate.CreateCRL
に変更されています。これはAPIの変更に合わせた正確なドキュメントの更新です。go/ast
パッケージの変更:CommentText
関数がast.CommentGroup
のText
メソッドになったことについて、リンクがgo/ast/#Text
からgo/ast/#CommentGroup.Text
に修正されました。これもAPIの変更に合わせた正確なドキュメントの更新です。os
パッケージのエラー値:os
パッケージのエラー値に関する記述で、ErrNoEnv
の代わりにErrNotExist
が例として挙げられるように修正されました。これは、より一般的なエラーケースを示すための変更と考えられます。
-
doc/reference.html
の変更点:go get
コマンドのリンク修正: 「Install them with "go get"」の箇所で、go get
コマンドへのリンクが/cmd/go/#Download_and_install_packages_and_dependencies
から/cmd/go/#hdr-Download_and_install_packages_and_dependencies
に修正されました。これは、HTMLのアンカーIDの変更に対応したものです。
全体として、これらの変更は、Go言語のドキュメントが常に最新のAPI、ツールの動作、およびベストプラクティスを正確に反映するようにするための継続的な努力を示しています。特に、内部的な関数表現の変更やAPIシグネチャの変更など、Go言語自体の進化に伴うドキュメントの追従が重要であることが伺えます。
コアとなるコードの変更箇所
diff --git a/doc/go1.1.html b/doc/go1.1.html
index 03a457dc58..71517fc2d8 100644
--- a/doc/go1.1.html
+++ b/doc/go1.1.html
@@ -215,7 +215,7 @@ i := int(int32(x))\n <h3 id=\"heap\">Heap size on 64-bit architectures</h3>\n \n <p>\n-On 64-bit architectures only, the maximum heap size has been enlarged substantially,\n+On 64-bit architectures, the maximum heap size has been enlarged substantially,\n from a few gigabytes to several tens of gigabytes.\n (The exact details depend on the system and may change.)\n </p>\n@@ -288,8 +288,9 @@ The byte-order-mark change is strictly backward-compatible.\n <h3 id=\"race\">Race detector</h3>\n \n <p>\n-A major addition to the tools is a <em>race detector</em>, a way to find\n-bugs in programs caused by problems like concurrent changes to the same variable.\n+A major addition to the tools is a <em>race detector</em>, a way to\n+find bugs in programs caused by concurrent access of the same\n+variable, where at least one of the accesses is a write.\n This new facility is built into the <code>go</code> tool.\n For now, it is only available on Linux, Mac OS X, and Windows systems with\n 64-bit x86 processors.\n@@ -301,7 +302,8 @@ The race detector is documented in <a href=\"/doc/articles/race_detector.html\">a\n <h3 id=\"gc_asm\">The gc assemblers</h3>\n \n <p>\n-Due to the change of the <a href=\"#int\"><code>int</code></a> to 64 bits and some other changes,\n+Due to the change of the <a href=\"#int\"><code>int</code></a> to 64 bits and\n+a new internal <a href=\"http://golang.org/s/go11func\">representation of functions</a>,\n the arrangement of function arguments on the stack has changed in the gc tool chain.\n Functions written in assembly will need to be revised at least\n to adjust frame pointer offsets.\n@@ -336,7 +338,7 @@ can\'t load package: package foo/quxx: cannot find package \"foo/quxx\" in any of:\n Second, the <code>go get</code> command no longer allows <code>$GOROOT</code>\n as the default destination when downloading package source.\n To use the <code>go get</code>\n-command, a valid <code>$GOPATH</code> is now required.\n+command, a <a href=\"/doc/code.html#GOPATH\">valid <code>$GOPATH</code></a> is now required.\n </p>\n \n <pre>\n@@ -358,7 +360,8 @@ package code.google.com/p/foo/quxx: cannot download, $GOPATH must not be set to\n <h3 id=\"gotest\">Changes to the go test command</h3>\n \n <p>\n-The <code>go test</code> command no longer deletes the binary when run with profiling enabled,\n+The <a href=\"/cmd/go/#hdr-Test_packages\"><code>go test</code></a>\n+command no longer deletes the binary when run with profiling enabled,\n to make it easier to analyze the profile.\n The implementation sets the <code>-c</code> flag automatically, so after running,\n </p>\n@@ -372,7 +375,8 @@ the file <code>mypackage.test</code> will be left in the directory where <code>g\n </p>\n \n <p>\n-The <code>go test</code> command can now generate profiling information\n+The <a href=\"/cmd/go/#hdr-Test_packages\"><code>go test</code></a>\n+command can now generate profiling information\n that reports where goroutines are blocked, that is,\n where they tend to stall waiting for an event such as a channel communication.\n The information is presented as a\n@@ -397,7 +401,8 @@ to convert the code to Go 1.0 first.\n <h3 id=\"gorun\">Changes to the go run command</h3>\n \n <p>\n-The <code>go run</code> command now runs all files in the current working\n+The <a href=\"/cmd/go/#hdr-Compile_and_run_Go_program\"><code>go run</code></a>\n+command now runs all files in the current working\n directory if no file arguments are listed. Also, the <code>go run</code>\n command now returns an error if test files are provided on the command line. In\n this sense, \"<code>go run</code>\" replaces \"<code>go run *.go</code>\".\ndiff --git a/doc/go1.html b/doc/go1.html\nindex 491fd7bf73..2687827c0e 100644\n--- a/doc/go1.html\n+++ b/doc/go1.html
@@ -998,9 +998,9 @@ Running <code>go</code> <code>fix</code> will perform the needed changes.\n <p>\n In Go 1, the\n <a href=\"/pkg/crypto/x509/#CreateCertificate\"><code>CreateCertificate</code></a>\n-and\n-<a href=\"/pkg/crypto/x509/#CreateCRL\"><code>CreateCRL</code></a>\n-functions in <code>crypto/x509</code> have been altered to take an\n+function and\n+<a href=\"/pkg/crypto/x509/#Certificate.CreateCRL\"><code>CreateCRL</code></a>\n+method in <code>crypto/x509</code> have been altered to take an\n <code>interface{}</code> where they previously took a <code>*rsa.PublicKey</code>\n or <code>*rsa.PrivateKey</code>. This will allow other public key algorithms\n to be implemented in the future.\n@@ -1183,7 +1183,7 @@ if set to <a href=\"/pkg/go/doc/#AllDecls\"><code>AllDecls</code></a>, all declara\n (not just exported ones) are considered.\n The function <code>NewFileDoc</code> was removed, and the function\n <code>CommentText</code> has become the method\n-<a href=\"/pkg/go/ast/#Text\"><code>Text</code></a> of\n+<a href=\"/pkg/go/ast/#CommentGroup.Text\"><code>Text</code></a> of\n <a href=\"/pkg/go/ast/#CommentGroup\"><code>ast.CommentGroup</code></a>.\n </p>\n \n@@ -1497,7 +1497,7 @@ to test common error properties, plus a few new error values\n with more Go-like names, such as\n <a href=\"/pkg/os/#ErrPermission\"><code>ErrPermission</code></a>\n and\n-<a href=\"/pkg/os/#ErrNoEnv\"><code>ErrNoEnv</code></a>.\n+<a href=\"/pkg/os/#ErrNotExist\"><code>ErrNotExist</code></a>.\n </p>\n \ndiff --git a/doc/reference.html b/doc/reference.html
index 88957bc67b..241d75a439 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -43,7 +43,7 @@ same variable in a different goroutine.\n These packages are part of the Go Project but outside the main Go tree.\n They are developed under looser <a href=\"/doc/go1compat.html\">compatibility\n requirements</a> than the Go core.\n-Install them with \"<code><a href=\"/cmd/go/#Download_and_install_packages_and_dependencies\">go get</a></code>\".\n+Install them with \"<code><a href=\"/cmd/go/#hdr-Download_and_install_packages_and_dependencies\">go get</a></code>\".\n </p>\n \n <ul>\n```
## コアとなるコードの解説
このセクションでは、上記の `diff` 出力に基づいて、各ファイルの変更点を詳細に解説します。
### `doc/go1.1.html`
* **L215,7 -> L215,7 (`<h3 id="heap">Heap size on 64-bit architectures</h3>`)**:
* `-On 64-bit architectures only, the maximum heap size has been enlarged substantially,`
* `+On 64-bit architectures, the maximum heap size has been enlarged substantially,`
* **解説**: 「only」という単語が削除されました。これは、64ビットアーキテクチャにおけるヒープサイズの拡張が、特定の条件下でのみ発生するのではなく、64ビット環境全般にわたる一般的な特性であることを明確にするための微調整です。
* **L288,8 -> L288,9 (`<h3 id="race">Race detector</h3>`)**:
* `-A major addition to the tools is a <em>race detector</em>, a way to find`
* `-bugs in programs caused by problems like concurrent changes to the same variable.`
* `+A major addition to the tools is a <em>race detector</em>, a way to`
* `+find bugs in programs caused by concurrent access of the same`
* `+variable, where at least one of the accesses is a write.`
* **解説**: 競合検出器の定義がより厳密になりました。以前の「concurrent changes to the same variable」(同じ変数への同時変更)という記述は、読み取り専用の同時アクセスも含む可能性があり、データ競合の正確な定義とは異なりました。新しい記述「concurrent access of the same variable, where at least one of the accesses is a write」(同じ変数への同時アクセスで、少なくとも1つのアクセスが書き込みである場合)は、データ競合の正確な条件を反映しており、ツールの機能がより明確に伝わるようになりました。
* **L301,7 -> L302,8 (`<h3 id="gc_asm">The gc assemblers</h3>`)**:
* `-Due to the change of the <a href="#int"><code>int</code></a> to 64 bits and some other changes,`
* `+Due to the change of the <a href="#int"><code>int</code></a> to 64 bits and`
* `+a new internal <a href="http://golang.org/s/go11func">representation of functions</a>,`
* **解説**: `int` 型の64ビット化に加えて、Go 1.1で導入された新しい内部関数表現が、`gc` ツールチェーンにおけるスタック上の関数引数の配置に影響を与えることが明記されました。`http://golang.org/s/go11func` への新しいリンクが追加され、この変更に関する詳細情報へのアクセスが提供されています。これにより、アセンブリコードを記述する開発者にとって重要な情報が補完されました。
* **L336,7 -> L338,7 (`<h3 id="go_get">Changes to the go get command</h3>`)**:
* `-command, a valid <code>$GOPATH</code> is now required.`
* `+command, a <a href="/doc/code.html#GOPATH">valid <code>$GOPATH</code></a> is now required.`
* **解説**: `go get` コマンドが `GOPATH` を必須とするようになったことについて、`GOPATH` の詳細な説明が記載されている `/doc/code.html#GOPATH` へのリンクが追加されました。これにより、ユーザーは `GOPATH` の設定方法や意味について、より簡単に参照できるようになりました。
* **L358,7 -> L360,8 (`<h3 id="gotest">Changes to the go test command</h3>`)**:
* `-The <code>go test</code> command no longer deletes the binary when run with profiling enabled,`
* `+The <a href="/cmd/go/#hdr-Test_packages"><code>go test</code></a>`
* `+command no longer deletes the binary when run with profiling enabled,`
* **解説**: `go test` コマンドがプロファイリング有効時にテストバイナリを削除しなくなったことについて、`go test` コマンドの公式ドキュメントの該当セクション(`cmd/go` の `Test_packages` ヘッダー)へのリンクが追加されました。これにより、ユーザーは `go test` の詳細な動作変更について、より正確な情報源を参照できるようになりました。
* **L372,7 -> L375,8 (`<p>The <code>go test</code> command can now generate profiling information...`)**:
* `-The <code>go test</code> command can now generate profiling information`
* `+The <a href="/cmd/go/#hdr-Test_packages"><code>go test</code></a>`
* `+command can now generate profiling information`
* **解説**: ゴルーチンのブロックプロファイリング機能に関する記述にも、同様に `go test` コマンドの公式ドキュメントへのリンクが追加されました。これは、ドキュメント内の関連する情報へのナビゲーションを改善するためのものです。
* **L397,7 -> L400,8 (`<h3 id="gorun">Changes to the go run command</h3>`)**:
* `-The <code>go run</code> command now runs all files in the current working`
* `+The <a href="/cmd/go/#hdr-Compile_and_run_Go_program"><code>go run</code></a>`
* `+command now runs all files in the current working`
* **解説**: `go run` コマンドの動作変更(引数なしでカレントディレクトリの全ファイルを対象とする、テストファイルを指定するとエラーになるなど)について、`go run` コマンドの公式ドキュメントの該当セクション(`cmd/go` の `Compile_and_run_Go_program` ヘッダー)へのリンクが追加されました。これにより、ユーザーは `go run` の詳細な動作変更について、より正確な情報源を参照できるようになりました。
### `doc/go1.html`
* **L998,9 -> L1001,9 (`<p>In Go 1, the <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>...`)**:
* `-and`
* `-<a href="/pkg/crypto/x509/#CreateCRL"><code>CreateCRL</code></a>`
* `-functions in <code>crypto/x509</code> have been altered to take an`
* `+function and`
* `+<a href="/pkg/crypto/x509/#Certificate.CreateCRL"><code>CreateCRL</code></a>`
* `+method in <code>crypto/x509</code> have been altered to take an`
* **解説**: `crypto/x509` パッケージにおける `CreateCRL` のAPI変更が反映されました。Go 1のリリース後、`CreateCRL` は独立した関数ではなく、`Certificate` 型のメソッドとして提供されるようになりました。この変更は、ドキュメント内のリンクと記述を、実際のAPIの構造に合わせて修正したものです。
* **L1183,7 -> L1185,7 (`<p>The function <code>NewFileDoc</code> was removed, and the function <code>CommentText</code>...`)**:
* `- <a href="/pkg/go/ast/#Text"><code>Text</code></a> of`
* `+<a href="/pkg/go/ast/#CommentGroup.Text"><code>Text</code></a> of`
* **解説**: `go/ast` パッケージにおける `CommentText` 関数の変更が反映されました。`CommentText` は `ast.CommentGroup` 型のメソッド `Text` に変更されました。これに伴い、ドキュメント内のリンクも `go/ast/#Text` から `go/ast/#CommentGroup.Text` に修正され、より正確なAPIリファレンスを指すようになりました。
* **L1497,7 -> L1499,7 (`<p>to test common error properties, plus a few new error values...`)**:
* `-and`
* `-<a href="/pkg/os/#ErrNoEnv"><code>ErrNoEnv</code></a>.`
* `+and`
* `+<a href="/pkg/os/#ErrNotExist"><code>ErrNotExist</code></a>.`
* **解説**: `os` パッケージのエラー値の例として、`ErrNoEnv`(環境変数が見つからないエラー)から `ErrNotExist`(ファイルやディレクトリが存在しないエラー)に変更されました。これは、より一般的で頻繁に遭遇するエラーケースを例として示すための変更と考えられます。
### `doc/reference.html`
* **L43,7 -> L45,7 (`<p>Install them with "<code><a href="/cmd/go/#Download_and_install_packages_and_dependencies">go get</a></code>".`)**:
* `-Install them with "<code><a href="/cmd/go/#Download_and_install_packages_and_dependencies">go get</a></code>".`
* `+Install them with "<code><a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a></code>".`
* **解説**: `go get` コマンドへのリンクのアンカーIDが修正されました。HTMLドキュメント内のヘッダーIDが変更されたことに対応し、`#Download_and_install_packages_and_dependencies` から `#hdr-Download_and_install_packages_and_dependencies` に更新されました。これにより、リンク切れを防ぎ、ユーザーが正確なセクションにジャンプできるようになりました。
これらの変更は、Go言語のドキュメントが常に最新かつ正確な情報を提供し、ユーザーがGo言語のツールやAPIを効果的に利用できるようにするための継続的な改善努力の一環です。
## 関連リンク
* Go言語公式ドキュメント: [https://golang.org/doc/](https://golang.org/doc/)
* Go 1.1 Release Notes: [https://golang.org/doc/go1.1](https://golang.org/doc/go1.1)
* Go 1 Release Notes: [https://golang.org/doc/go1](https://golang.org/doc/go1)
* Go Race Detector: [https://golang.org/doc/articles/race_detector.html](https://golang.org/doc/articles/race_detector.html)
* The Go Programming Language Specification: [https://golang.org/ref/spec](https://golang.org/ref/spec)
* Go Command Documentation (`go test`, `go run`, `go get`): [https://golang.org/cmd/go/](https://golang.org/cmd/go/)
* `GOPATH` の説明: [https://golang.org/doc/code.html#GOPATH](https://golang.org/doc/code.html#GOPATH)
## 参考にした情報源リンク
* Go 1.1 Release Notes: [https://golang.org/doc/go1.1](https://golang.org/doc/go1.1)
* Go 1 Release Notes: [https://golang.org/doc/go1](https://golang.org/doc/go1)
* Go Race Detector: [https://golang.org/doc/articles/race_detector.html](https://golang.org/doc/articles/race_detector.html)
* Go Command Documentation: [https://golang.org/cmd/go/](https://golang.org/cmd/go/)
* Go `crypto/x509` package: [https://pkg.go.dev/crypto/x509](https://pkg.go.dev/crypto/x509)
* Go `go/ast` package: [https://pkg.go.dev/go/ast](https://pkg.go.dev/go/ast)
* Go `os` package: [https://pkg.go.dev/os](https://pkg.go.dev/os)
* HTML anchors: [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href)
* Brad Fitzpatrick's CL 8729050: [https://golang.org/cl/8729050](https://golang.org/cl/8729050) (これは元コミット内容に記載されているリンクであり、今回の解説の直接的な情報源です)