[インデックス 12341] ファイルの概要
このコミットは、Go言語のソースからのインストール手順を説明するドキュメント doc/install-source.html
の更新に関するものです。このファイルは、Goのソースコードをビルドし、実行するための詳細なガイドを提供しています。
コミット
doc/install-source.html: update for go tool Make some updates, get rid of mentions of make. There remain a number of open questions.
R=golang-dev, gri CC=golang-dev https://golang.org/cl/5720057
GitHub上でのコミットページへのリンク
https://github.com/golang/go/commit/95d7d3d658989cb2af98f753b9731a4af3e363be
元コミット内容
commit 95d7d3d658989cb2af98f753b9731a4af3e363be
Author: Rob Pike <r@golang.org>
Date: Sat Mar 3 09:36:09 2012 +1100
doc/install-source.html: update for go tool
Make some updates, get rid of mentions of make.
There remain a number of open questions.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5720057
変更の背景
このコミットの主な背景は、Go言語のビルドシステムが make
ベースのシステムから、よりGoネイティブな go tool
コマンド群へと移行している過渡期にあったことです。Goプロジェクトは、その初期段階において、C言語で書かれた部分やビルドプロセスに make
を利用していました。しかし、Go言語自体の成熟とエコシステムの発展に伴い、Go言語で書かれたツール (go tool
) を用いてGoプロジェクト全体をビルド・管理する方向へとシフトしていきました。
この変更は、ユーザーがGoのソースからビルドする際の体験を簡素化し、Goのツールチェーンに統一することを目的としています。make
の言及を削除し、go tool
に関連する情報に更新することで、ドキュメントが最新のビルド推奨事項を反映するようにしています。また、多くのユーザーがプリコンパイルされたバイナリパッケージからインストールすることの重要性を強調し、ソースからのビルドは開発者向けであることを明確にしています。
前提知識の解説
go tool
: Go言語の公式ツールチェーンの中核をなすコマンド群です。コンパイル、テスト、フォーマット、依存関係管理など、Go開発における様々なタスクを実行するためのサブコマンド(例:go build
,go test
,go fmt
)を提供します。Go 1.0のリリースに向けて、make
に代わる主要なビルドメカニズムとして確立されました。make
: Unix系システムで広く使われているビルド自動化ツールです。Makefile
に記述されたルールに基づいて、ソースコードのコンパイルやリンクなどの処理を実行します。Goプロジェクトの初期には、Goコンパイラ自体のビルドや、C言語で書かれたランタイム部分のビルドに利用されていました。gc
コンパイラ: Go言語の公式コンパイラで、Go言語で書かれたコードをネイティブバイナリにコンパイルします。6g
,8g
,5g
などは、それぞれamd64
,x86
,ARM
アーキテクチャ向けのgc
コンパイラの旧称です。gccgo
: GCC (GNU Compiler Collection) のフロントエンドとして実装されたGoコンパイラです。gc
コンパイラとは異なる実装であり、GCCの最適化やクロスコンパイルの機能を利用できます。GOROOT
: Goのインストールディレクトリのルートパスを示す環境変数です。Goの標準ライブラリやツールが配置されています。GOPATH
: Go 1.11以前のGoプロジェクトのワークスペースのルートパスを示す環境変数です。Goのソースコード、パッケージ、実行可能ファイルが配置される場所を定義していました。Go Modulesの導入により、その重要性は低下しましたが、古いプロジェクトや特定のワークフローでは依然として使用されます。- Mercurial (hg): 分散型バージョン管理システムの一つです。Goプロジェクトは、初期にはGitではなくMercurialを主要なバージョン管理システムとして使用していました。このドキュメントの記述にもその名残が見られます(例:
hg update weekly
)。 - Goのリリースプロセス: Goプロジェクトは、安定版リリース (
release
タグ) と週次スナップショット (weekly
タグ) を提供していました。これは、開発の進捗を追跡し、ユーザーが最新の変更を試すためのメカニズムでした。
技術的詳細
このコミットは、Goのビルドシステムが make
から go tool
へと移行する過程におけるドキュメントの調整を反映しています。
make
の言及の削除: 以前のドキュメントでは、Goのソースからのビルドにmake
コマンドを使用する指示が含まれていました。このコミットでは、これらのmake
への参照が削除され、Goのビルドプロセスがgo tool
を中心に行われるようになったことを示唆しています。特に、$GOROOT
の説明において、「$GOROOT
を設定しない場合、従来のmakefiles
を使用してGoプログラムを開発する際にはmake
またはgmake
の代わりにgomake
を実行する必要がある」という記述が削除されています。これは、gomake
やmake
を使ったビルドがもはや標準的な方法ではないことを意味します。go tool
への移行の強調: ドキュメントは、Goのインストールが「go tool
」によって行われることを暗黙的に示唆するようになっています。これは、Go 1.0で導入された統一されたgo
コマンドラインツールが、ビルド、テスト、インストールなどのすべてのGo関連操作の中心となることを反映しています。- インストールプロセスの明確化: ほとんどのユーザーはプリコンパイルされたバイナリパッケージからインストールすべきであり、ソースからのビルドは開発者向けであるという点が強調されています。これにより、ユーザーが不必要に複雑なソースからのビルドプロセスに直面するのを避けることができます。
- 環境変数の説明の更新:
GOROOT
やGOPATH
といった環境変数に関する説明が更新されています。特にGOROOT
については、「ビルドによって必須ではない」という点が強調され、その値がコンパイル時にツリーに組み込まれること、そして複数のローカルリポジトリを切り替える場合を除いて設定する必要がないことが明記されています。これは、Goのビルドシステムがより自己完結的になり、環境変数への依存が減ったことを示しています。 - コミュニティリソースの整理: コミュニティリソースに関するセクションが整理され、
#go-nuts
IRCチャンネルやGo Nuts
メーリングリスト、golang-checkins
メーリングリスト、Go issue trackerへのリンクがより簡潔にまとめられています。 - TODOコメントの追加: ドキュメントのいくつかの箇所に
XXX TODO XXX
やXXX FONT IS WRONG IN THESE ENTRIES XXX
といったコメントが追加されており、これはドキュメントがまだ完全に完成しておらず、将来的な改善の余地があることを示しています。
これらの変更は、Go言語が初期の実験段階から、より成熟した、使いやすい開発環境へと進化していく過程の一部を示しています。
コアとなるコードの変更箇所
doc/install-source.html
ファイルに対する変更です。
--- a/doc/install-source.html
+++ b/doc/install-source.html
@@ -5,21 +5,31 @@
<h2 id="introduction">Introduction</h2>
-<p>Go is an open source project, distributed under a
+<p>
+Go is an open source project, distributed under a
<a href="/LICENSE">BSD-style license</a>.
This document explains how to check out the sources,
build them on your own machine, and run them.
</p>
+<p>
+Most users don't need to do this, and will instead install
+from precompiled binary packages as described in
+<a href="/doc/install.html">Getting Started</a>,
+a much simpler process.
+If you want to help develop what goes into those precompiled
+packages, though, read on.
+</p>
+
<div class="detail">
<p>
There are two official Go compiler tool chains.
This document focuses on the <code>gc</code> Go
compiler and tools (<code>6g</code>, <code>8g</code> etc.).
-For information on how to use <code>gccgo</code>, a more traditional
+For information on how to work on <code>gccgo</code>, a more traditional
compiler using the GCC back end, see
-<a href="/install/gccgo/">Setting up and using gccgo</a>.
+<a href="/doc/gccgo_install.html">Setting up and using gccgo</a>.
</p>
<p>
@@ -33,7 +43,7 @@ architectures.
<code>amd64</code> (a.k.a. <code>x86-64</code>); <code>6g,6l,6c,6a</code>
</dt>
<dd>
- The most mature implementation. The compiler has an effective
+ A mature implementation. The compiler has an effective
optimizer (registerizer) and generates good code (although
<code>gccgo</code> can do noticeably better sometimes).
</dd>
@@ -47,7 +57,8 @@ architectures.
<code>arm</code> (a.k.a. <code>ARM</code>); <code>5g,5l,5c,5a</code>
</dt>
<dd>
- Supports only Linux binaries. Less tested than the other ports.
+ Supports only Linux binaries. Less widely used than the other ports and therefore
+ not as thoroughly tested.
</dd>
</dl>
@@ -113,7 +124,7 @@ You might try this first:\n <p>\n If that fails, try installing manually from the\n <a href="http://mercurial.selenic.com/wiki/Download">Mercurial Download</a>\n-page.</p>\n+page.\n </p>\n
<p>
@@ -136,7 +147,6 @@ if necessary.\n
<h2 id="fetch">Fetch the repository</h2>
-<p>
<p>Go will install to a directory named <code>go</code>.
Change to the directory that will be its parent
and make sure the <code>go</code> directory does not exist.\n@@ -222,58 +232,31 @@ If you see the "hello, world" message then Go is installed correctly.\n </p>\n
-<h2 id="next">What's next</h2>
-\n-<p>\n-Start by taking <a href="http://tour.golang.org/">A Tour of Go</a>.\n-</p>\n-\n-<p>\n-For more detail about the process of building and testing Go programs\n-read <a href="/doc/code.html">How to Write Go Code</a>.\n-</p>\n-\n-<p>\n-Build a web application by following the <a href="/doc/articles/wiki/">Wiki\n-Tutorial</a>.\n-</p>\n-\n-<p>\n-Read <a href="/doc/effective_go.html">Effective Go</a> to learn about writing\n-idiomatic Go code.\n-</p>\n-\n-<p>\n-For the full story, consult Go's extensive \n-<a href="/doc/">documentation</a>.\n-</p>\n-\n-\n <h2 id="community">Community resources</h2>
-\n <p>
--For real-time help, there may be users or developers on
--<code>#go-nuts</code> on the <a href="http://freenode.net/">Freenode</a> IRC server.\n--</p>\n-\n-<p>\n-The official mailing list for discussion of the Go language is\n-<a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>.\n+The usual community resources such as
+<code>#go-nuts</code> on the <a href="http://freenode.net/">Freenode</a> IRC server
+and the
+<a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>
+mailing list have active developers that can help you with problems
+with your installation or your development work.
+For those who wish to keep up to date,
+there is another mailing list, <a href="http://groups.google.com/group/golang-checkins">golang-checkins</a>,
+that receives a message summarizing each checkin to the Go repository.
</p>
<p>
Bugs can be reported using the <a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.\n </p>\n
-<p>
--For those who wish to keep up with development,\n--there is another mailing list, <a href="http://groups.google.com/group/golang-checkins">golang-checkins</a>,\n--that receives a message summarizing each checkin to the Go repository.\n--</p>\n-\n \n <h2 id="releases">Keeping up with releases</h2>
-\n+<p>
+XXX TODO XXX
+</p>
+\n <p>
The Go project maintains two stable tags in its Mercurial repository:\n <code>release</code> and <code>weekly</code>.\n@@ -311,7 +294,7 @@ To use the <code>weekly</code> tag run <code>hg update weekly</code> instead.\n
<p>\n The Go compilation environment can be customized by environment variables.\n-<i>None are required by the build</i>, but you may wish to set them\n+<i>None is required by the build</i>, but you may wish to set some\n to override the defaults.\n </p>\n
@@ -321,11 +304,14 @@ to override the defaults.\n </dt>\n <dd>\n <p>\n+\tXXX FONT IS WRONG IN THESE ENTRIES XXX\n+\tXXX I NEED SOME SPAN THING XXX\n The root of the Go tree, often <code>$HOME/go</code>.\n-\tThis defaults to the parent of the directory where <code>all.bash</code> is run.\n-\tIf you choose not to set <code>$GOROOT</code>, you must\n-\trun <code>gomake</code> instead of <code>make</code> or <code>gmake</code>\n-\twhen developing Go programs using the conventional makefiles.\n+\tIts value is built into the tree when it is compiled, and\n+\tdefaults to the parent of the directory where <code>all.bash</code> was run.\n+\tThere is no need to set this unless you want to switch between multiple\n+\tlocal copies of the repository.\n+\t</p>\n </dd>\n
<dt>\n@@ -334,11 +320,12 @@ to override the defaults.\n <dd>\n <p>\n The value assumed by installed binaries and scripts when\n-\t<code>$GOROOT</code> is not set.\n-\tIt defaults to the value used for <code>$GOROOT</code>.\n+\t<code>$GOROOT</code> is not set explicitly.\n+\tIt defaults to the value of <code>$GOROOT</code>.\n If you want to build the Go tree in one location\n but move it elsewhere after the build, set \n <code>$GOROOT_FINAL</code> to the eventual location.\n+\t</p>\n </dd>\n
<dt>\n@@ -406,7 +393,6 @@ to override the defaults.\n <td></td><td><code>windows</code></td> <td><code>amd64</code></td>\n </tr>\n </table>\n-\t<p>\n </dd>\n
<dt>\n@@ -431,7 +417,8 @@ to override the defaults.\n </dt>\n <dd>\n <p>\n-\tThe location where binaries will be installed.\n+\tThe location where binaries from the main repository will be installed.\n+\tXXX THIS MAY CHANGE TO BE AN OVERRIDE EVEN FOR GOPATH ENTRIES XXX\n The default is <code>$GOROOT/bin</code>.\n After installing, you will want to arrange to add this\n directory to your <code>$PATH</code>, so you can use the tools.\n@@ -472,3 +459,8 @@ export GOROOT=$HOME/go\n export GOARCH=amd64\n export GOOS=linux\n </pre>\n+\n+<p>\n+although, to reiterate, none of these variables needs to be set to build,\n+install, and develop the Go tree.\n+</p>\n```
## コアとなるコードの解説
このコミットは、主にGoのソースからのインストールガイド `doc/install-source.html` のテキストコンテンツを修正しています。
1. **導入部の変更**:
* Goのソースからのビルドが「ほとんどのユーザーには不要」であり、代わりにプリコンパイルされたバイナリパッケージからのインストールが推奨される旨が明確に追加されました。これは、Goの利用者が増え、より手軽なインストール方法が求められるようになった背景を反映しています。
* `gccgo` のインストールガイドへのリンクが `/install/gccgo/` から `/doc/gccgo_install.html` に変更されました。これはドキュメントの整理とパスの標準化を示唆しています。
2. **コンパイラ実装の説明の調整**:
* `amd64` (6g) の実装が「The most mature implementation.」から「A mature implementation.」に修正されました。これは、他のアーキテクチャやコンパイラ(特に `gccgo`)も成熟してきたことを示唆している可能性があります。
* `arm` (5g) の説明が「Less tested than the other ports.」から「Less widely used than the other ports and therefore not as thoroughly tested.」に変更されました。これは、テストの少なさが利用者の少なさに起因するという、より具体的な理由を提示しています。
3. **「What's next」セクションの削除**:
* Go Tour、Goコードの書き方、Wikiチュートリアル、Effective Go、Goのドキュメントへのリンクを含む「What's next」セクションが完全に削除されました。これは、インストールガイドの目的を純粋なインストール手順に絞り、学習リソースへの誘導は別の場所で行うというドキュメント戦略の変更を示唆しています。
4. **コミュニティリソースの統合と簡素化**:
* `#go-nuts` IRCチャンネルと `Go Nuts` メーリングリストに関する記述が統合され、より簡潔になりました。
* `golang-checkins` メーリングリストに関する記述も、以前は独立した段落でしたが、他のコミュニティリソースの説明に統合されました。
5. **環境変数に関する説明の更新**:
* `GOROOT` の説明が大幅に更新されました。以前は「`all.bash` が実行されたディレクトリの親がデフォルト」であり、「`$GOROOT` を設定しない場合、`gomake` を実行する必要がある」とされていましたが、新しい記述では「その値はコンパイル時にツリーに組み込まれる」こと、「`all.bash` が実行されたディレクトリの親がデフォルト」であること、そして「複数のローカルリポジトリを切り替える場合を除いて設定する必要がない」ことが強調されています。これは、Goのビルドシステムがより自己完結的になり、ユーザーが明示的に `GOROOT` を設定する必要性が減ったことを示しています。また、`make` や `gomake` の言及が削除されたことで、ビルドプロセスが `go tool` に統一されたことが明確に示されています。
* `GOPATH` の説明も更新され、`GOROOT` が明示的に設定されていない場合のデフォルト値に関する記述がより明確になりました。
* `GOBIN` の説明に「XXX THIS MAY CHANGE TO BE AN OVERRIDE EVEN FOR GOPATH ENTRIES XXX」というTODOコメントが追加されており、将来的に `GOPATH` エントリに対してもオーバーライド可能になる可能性が示唆されています。
* 最後に、環境変数はビルド、インストール、開発に「設定する必要がない」という点が改めて強調されています。
6. **TODOコメントの追加**:
* `releases` セクションに `XXX TODO XXX` が追加され、このセクションが未完成であることを示しています。
* `GOROOT` の説明に「XXX FONT IS WRONG IN THESE ENTRIES XXX XXX I NEED SOME SPAN THING XXX」というコメントが追加され、表示上の問題があることを示しています。
これらの変更は、Goのビルドシステムとドキュメントが進化し、よりユーザーフレンドリーで、Goのツールチェーンに沿ったものになる過程を反映しています。
## 関連リンク
* [Go言語公式サイト](https://go.dev/)
* [A Tour of Go](https://tour.golang.org/welcome/1) (Go言語のインタラクティブなチュートリアル)
* [How to Write Go Code](https://go.dev/doc/code) (Goコードの書き方に関する公式ドキュメント)
* [Effective Go](https://go.dev/doc/effective_go) (Go言語のイディオムとベストプラクティスに関するガイド)
* [Go Documentation](https://go.dev/doc/) (Go言語の公式ドキュメント)
## 参考にした情報源リンク
* コミット情報: `/home/orange/Project/comemo/commit_data/12341.txt`
* GitHubコミットページ: [https://github.com/golang/go/commit/95d7d3d658989cb2af98f753b9731a4af3e363be](https://github.com/golang/go/commit/95d7d3d658989cb2af98f753b9731a4af3e363be)
* Go言語の歴史とビルドシステムに関する一般的な知識
* Go 1.0リリースノート (Go toolの導入に関する情報)
* Mercurialの公式ドキュメント (Mercurialのコマンドに関する情報)
* GCCGoの公式ドキュメント (GCCGoに関する情報)
* Goの環境変数に関する公式ドキュメント (GOROOT, GOPATHなど)
* Go Modulesに関する情報 (GOPATHの役割の変化について)
* Freenode IRCネットワークに関する情報
* Google Groups (golang-nuts, golang-checkins) に関する情報
* Go issue trackerに関する情報