[インデックス 13657] ファイルの概要
このコミットは、Go言語のインストールに関するドキュメント(doc/install-source.html
および doc/install.html
)を更新し、macOS (旧称 OS X) 上でのGoのビルドまたはインストールにおいて、Xcode全体ではなく「Command Line Tools for Xcode」のみが必要であることを明確にしています。これにより、ユーザーがGoをセットアップする際の障壁を低減し、より正確な情報を提供することを目的としています。
コミット
commit 27010467984dcef481e5b05113a6fbcf74b4df45
Author: Shenghou Ma <minux.ma@gmail.com>
Date: Mon Aug 20 21:21:09 2012 +0800
doc/install: we only need command line tools for Xcode on OS X
Fixes #3973.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6464078
GitHub上でのコミットページへのリンク
https://github.com/golang/go/commit/27010467984dcef481e5b05113a6fbcf74b4df45
元コミット内容
doc/install: we only need command line tools for Xcode on OS X
(doc/install: OS X上ではXcodeのコマンドラインツールのみが必要)
Fixes #3973.
(Issue #3973 を修正)
変更の背景
このコミットは、Go言語のインストール手順に関するドキュメントの誤解を解消するために行われました。以前のドキュメントでは、macOS (当時はOS X) 上でGoをビルドするためにXcodeのインストールが必要であると示唆されていました。しかし、Goのビルドに必要なCコンパイラ(gcc
など)は、Xcode全体をインストールしなくても、「Command Line Tools for Xcode」として提供されることが可能です。Xcode全体は非常に容量が大きく、開発者によっては不要なコンポーネントも含まれるため、Goのビルドのためだけにインストールするのは非効率的でした。
この変更は、GoプロジェクトのIssue #3973("doc/install: clarify Xcode requirement on OS X" - doc/install: OS XでのXcode要件を明確化する)に対応するもので、ユーザーがGoをより簡単に、かつ最小限の環境でセットアップできるように、ドキュメントの正確性を向上させることを目的としています。特に、Xcode 4.3以降では、Command Line ToolsがXcodeのダウンロード設定パネルから個別にインストール可能になったため、この情報更新はユーザーにとって非常に有用でした。
前提知識の解説
- macOS (旧称 OS X): Appleが開発したUnixベースのオペレーティングシステム。Go言語はmacOS環境でも動作し、開発が可能です。
- Xcode: Appleが提供するmacOSおよびiOSアプリケーション開発のための統合開発環境(IDE)。C、C++、Objective-C、Swiftなどの言語に対応しており、コンパイラ(Clang/LLVM、以前はGCC)やデバッガ、シミュレータなどが含まれます。
- Command Line Tools for Xcode: Xcodeの一部として提供される、コマンドラインから利用できる開発ツール群です。これには、C/C++/Objective-Cコンパイラ(
clang
やgcc
)、make
、git
などの基本的な開発ツールが含まれます。Xcode全体をインストールしなくても、これらのツールを単独でインストールすることが可能です。Go言語のビルドプロセスでは、C言語で書かれた部分をコンパイルするためにCコンパイラが必要となる場合があります。 gcc
: GNU Compiler Collectionの略で、C、C++、Objective-C、Fortran、Ada、Goなどのプログラミング言語をサポートするコンパイラ群です。macOSでは、XcodeまたはCommand Line Toolsをインストールすることで利用可能になります。Go言語の初期のバージョンや、cgo
を使用する場合には、Cコンパイラ(gcc
またはclang
)が必要です。cgo
: Go言語の機能の一つで、C言語のコードをGoプログラムから呼び出すことを可能にします。cgo
を使用するGoプログラムをビルドする際には、Cコンパイラが必須となります。このコミットの変更箇所でもcgo
について言及されており、gcc
が必要となるケースとして挙げられています。- HTMLドキュメント: Goプロジェクトの公式ドキュメントはHTML形式で提供されており、ウェブブラウザを通じて閲覧されます。このコミットは、これらのHTMLドキュメントの内容を直接修正しています。
技術的詳細
このコミットは、Go言語の公式ドキュメントであるdoc/install-source.html
とdoc/install.html
の2つのファイルを修正しています。これらのファイルは、それぞれソースからのGoのビルド方法と、一般的なGoのインストール方法について記述しています。
主な変更点は以下の通りです。
- Xcodeの要件の明確化:
- 以前のドキュメントでは、「On OS X, a C compiler can be installed as part of Xcode.」(OS Xでは、CコンパイラはXcodeの一部としてインストールできます。)と記載されていました。
- これを「On OS X, a C compiler is bundled in the command line tools for Xcode, and you don't need to install the whole Xcode to compile Go.」(OS Xでは、CコンパイラはXcodeのコマンドラインツールにバンドルされており、GoをコンパイルするためにXcode全体をインストールする必要はありません。)と修正し、Xcode全体が不要であることを明示しました。
- Command Line Toolsのインストール方法の追記:
- Xcode 4.3以降のユーザー向けに、「If you have already installed Xcode 4.3+, you can install command line tools from the Components tab of the Downloads preferences panel.」(Xcode 4.3+を既にインストールしている場合、ダウンロード設定パネルのコンポーネントタブからコマンドラインツールをインストールできます。)という具体的な手順を追加しました。
gcc
の動作確認方法の提示:- コンパイラが正しくインストールされているかを確認するために、「To verify you have a working compiler, just invoke
gcc
in a freshly created Terminal window, unless you see the "gcc: command not found" error, you are ready to go.」(動作するコンパイラがあることを確認するには、新しく開いたターミナルウィンドウでgcc
を呼び出すだけです。「gcc: command not found」エラーが表示されない限り、準備完了です。)という簡単な確認方法を追記しました。
- コンパイラが正しくインストールされているかを確認するために、「To verify you have a working compiler, just invoke
- 脚注の追加と修正:
doc/install.html
では、gcc
の要件に関する脚注(<sup>†</sup>
)に加えて、Xcodeの要件に関する新しい脚注(<sup>‡</sup>
)を追加しました。この新しい脚注で、Xcodeのコマンドラインツールのみで十分であること、およびXcode 4.3+でのインストール方法を簡潔に説明しています。
これらの変更により、macOSユーザーがGoをインストールまたはビルドする際に、不要なXcodeのフルインストールを避け、より効率的に環境をセットアップできるよう、ドキュメントの正確性と利便性が向上しました。
コアとなるコードの変更箇所
diff --git a/doc/install-source.html b/doc/install-source.html
index f32d48d6d0..d9f9577a67 100644
--- a/doc/install-source.html
+++ b/doc/install-source.html
@@ -86,8 +86,14 @@ To build it, you need a C compiler installed.
</p>
<p>
-On OS X, a C compiler can be installed as part of
-<a href="http://developer.apple.com/Xcode/">Xcode</a>.
+On OS X, a C compiler is bundled in the command line tools for
+<a href="http://developer.apple.com/Xcode/">Xcode</a>,
+and you don't need to install the whole Xcode to compile Go.
+If you have already installed Xcode 4.3+, you can install command
+line tools from the Components tab of the Downloads preferences panel.
+To verify you have a working compiler, just invoke <code>gcc</code>
+in a freshly created Terminal window, unless you see the
+"<code>gcc: command not found</code>" error, you are ready to go.
</p>
<p>
diff --git a/doc/install.html b/doc/install.html
index ec78d2a5a8..39de519b08 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -42,12 +42,17 @@ proceeding. If your OS or architecture is not on the list, it's possible that
<tr><td colspan="3"><hr></td></tr>
<tr><td>FreeBSD 7 or later</td> <td>amd64, 386</td> <td>Debian GNU/kFreeBSD not supported</td></tr>
<tr><td>Linux 2.6.23 or later with glibc</td> <td>amd64, 386, arm</td> <td>CentOS/RHEL 5.x not supported; no binary distribution for ARM yet</td></tr>
-<tr><td>Mac OS X 10.6/10.7</td> <td>amd64, 386</td> <td>use the gcc<sup>†</sup> that comes with Xcode</td></tr>
+<tr><td>Mac OS X 10.6/10.7</td> <td>amd64, 386</td> <td>use the gcc<sup>†</sup> that comes with Xcode<sup>‡</sup></td></tr>
<tr><td>Windows 2000 or later</td> <td>amd64, 386</td> <td>use mingw gcc<sup>†</sup>; cygwin or msys is not needed</td></tr>
</table>
<p>
-<sup>†</sup><code>gcc</code> is required only if you plan to use <a href="/cmd/cgo">cgo</a>.\n
+<sup>†</sup><code>gcc</code> is required only if you plan to use\n
+<a href="/cmd/cgo">cgo</a>.<br/>\n
+<sup>‡</sup>You only need to install the command line tools for\n
+<a href="http://developer.apple.com/Xcode/">Xcode</a>. If you have already\n
+installed Xcode 4.3+, you can install it from the Components tab of the\n
+Downloads preferences panel.\n
</p>
<h2 id="download">Download the Go tools</h2>
コアとなるコードの解説
doc/install-source.html
の変更点
-
削除行 (
-
):On OS X, a C compiler can be installed as part of <a href="http://developer.apple.com/Xcode/">Xcode</a>.
この行は、CコンパイラがXcodeの一部としてインストールできるという、やや曖昧な表現を削除しています。
-
追加行 (
+
):On OS X, a C compiler is bundled in the command line tools for <a href="http://developer.apple.com/Xcode/">Xcode</a>, and you don't need to install the whole Xcode to compile Go. If you have already installed Xcode 4.3+, you can install command line tools from the Components tab of the Downloads preferences panel. To verify you have a working compiler, just invoke <code>gcc</code> in a freshly created Terminal window, unless you see the "<code>gcc: command not found</code>" error, you are ready to go.
この追加されたテキストは、以下の重要な情報を提供します。
- CコンパイラがXcodeの「コマンドラインツール」にバンドルされていること。
- GoをコンパイルするためにXcode全体をインストールする必要がないこと。
- Xcode 4.3以降のユーザー向けに、コマンドラインツールの具体的なインストール場所(ダウンロード設定パネルのコンポーネントタブ)を案内。
gcc
コマンドを実行してコンパイラのインストールを確認する方法。
これらの変更により、macOSユーザーはGoのビルドに必要な最小限のツールセットを理解し、効率的に環境をセットアップできるようになります。
doc/install.html
の変更点
-
変更行 (
-
から+
):-<tr><td>Mac OS X 10.6/10.7</td> <td>amd64, 386</td> <td>use the gcc<sup>†</sup> that comes with Xcode</td></tr> +<tr><td>Mac OS X 10.6/10.7</td> <td>amd64, 386</td> <td>use the gcc<sup>†</sup> that comes with Xcode<sup>‡</sup></td></tr>
この変更は、macOSの行に新しい脚注参照
<sup>‡</sup>
を追加しています。これにより、Xcodeに関する追加情報が脚注で提供されることを示唆しています。 -
変更行 (
-
から+
):-<p> -<sup>†</sup><code>gcc</code> is required only if you plan to use <a href="/cmd/cgo">cgo</a>. +</p> +<p> +<sup>†</sup><code>gcc</code> is required only if you plan to use\n +<a href="/cmd/cgo">cgo</a>.<br/>\n +<sup>‡</sup>You only need to install the command line tools for\n +<a href="http://developer.apple.com/Xcode/">Xcode</a>. If you have already\n +installed Xcode 4.3+, you can install it from the Components tab of the\n
+Downloads preferences panel.\n
``` このセクションでは、既存の脚注<sup>†</sup>
(cgo
を使用する場合にgcc
が必要であること)に加えて、新しい脚注<sup>‡</sup>
が追加されています。
新しい脚注は、doc/install-source.html
での変更と同様に、Xcode全体ではなくコマンドラインツールのみが必要であること、およびXcode 4.3+でのインストール方法を簡潔に説明しています。<br/>
タグが追加され、脚注が複数行にわたることを示しています。
これらの変更は、Goのインストールに関する主要なドキュメントページでも、macOSユーザーがXcodeの要件について正確な情報を得られるようにするためのものです。
関連リンク
- Go Issue #3973: https://code.google.com/p/go/issues/detail?id=3973 (元のIssueトラッカーのリンクですが、現在はGitHubに移行しています)
- Go CL 6464078: https://golang.org/cl/6464078 (Gerrit Code Reviewの変更リストへのリンク)
- Apple Developer Xcode: http://developer.apple.com/Xcode/
参考にした情報源リンク
- https://github.com/golang/go/commit/27010467984dcef481e5b05113a6fbcf74b4df45 (本コミットのGitHubページ)
- Go言語公式ドキュメント (一般的な知識として)
- XcodeおよびCommand Line Toolsに関するAppleの公式ドキュメント (一般的な知識として)