Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

[インデックス 12600] ファイルの概要

このコミットは、Go言語の公式ドキュメント doc/install.html に対して、Windows環境におけるGoのzipアーカイブからのインストール手順に関する説明を追加・修正するものです。特に、MSIインストーラーとzipアーカイブの2つのインストール方法があることを明確にし、zipアーカイブを使用した場合の環境変数(GOROOTPATH)の設定方法について詳細なガイダンスを提供しています。

コミット

commit cf46040784ad13ccd88aaea70e31f1dd89748cf9
Author: Andrew Gerrand <adg@golang.org>
Date:   Tue Mar 13 15:02:14 2012 +1100

    doc: windows zip archive installation instructions
    
    Fixes #3254.
    
    R=golang-dev, r
    CC=golang-dev
    https://golang.org/cl/5794071

GitHub上でのコミットページへのリンク

https://github.com/golang/go/commit/cf46040784ad13ccd88aaea70e31f1dd89748cf9

元コミット内容

doc: windows zip archive installation instructions

Fixes #3254.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5794071

変更の背景

このコミットは、Go言語のインストールに関するドキュメントの改善を目的としています。特に、WindowsユーザーがGoをインストールする際に、MSIインストーラーだけでなく、zipアーカイブを使用する選択肢があるにもかかわらず、その手順がドキュメントに十分に記載されていなかったことが背景にあります。コミットメッセージにある Fixes #3254 は、GoプロジェクトのIssueトラッカーにおける特定の課題(Issue 3254)を解決するためにこの変更が行われたことを示しています。このIssueは、WindowsにおけるzipアーカイブからのGoインストール手順に関する説明の不足や不明瞭さを指摘していたと考えられます。ユーザーがよりスムーズにGo環境をセットアップできるよう、ドキュメントの明確化と詳細化が求められていました。

前提知識の解説

  • Go言語のインストール: Go言語を使用するためには、まず開発環境をセットアップする必要があります。これには、Goコンパイラやツール群をシステムに導入する作業が含まれます。
  • 環境変数: オペレーティングシステムがプログラムの実行時に参照する設定値です。Goのインストールにおいては、特に以下の環境変数が重要です。
    • GOROOT: Goのインストールディレクトリのルートパスを指定します。GoツールがGoの標準ライブラリやツールを見つけるために使用します。
    • PATH: 実行可能ファイル(コマンド)を検索するディレクトリのリストです。goコマンドなどをどこからでも実行できるようにするために、GoのbinディレクトリをPATHに追加する必要があります。
  • Windowsにおける環境変数の設定: Windowsでは、GUI(システムのプロパティ)またはコマンドプロンプト(setコマンドやsetxコマンド)を通じて環境変数を設定できます。GUIでの設定は永続的であり、システム全体またはユーザーアカウントに適用されます。
  • MSIインストーラー: Microsoft Installerの略で、Windowsアプリケーションのインストール、メンテナンス、削除を行うためのパッケージ形式です。通常、ウィザード形式で対話的にインストールを進めることができます。
  • Zipアーカイブ: 複数のファイルやディレクトリを一つのファイルにまとめた圧縮形式です。Goのzipアーカイブは、Goの実行可能ファイルやライブラリが圧縮された形で提供され、ユーザーが任意の場所に展開して手動で環境設定を行う必要があります。
  • doc/install.html: Go言語の公式ドキュメントの一部で、Goのインストール方法について説明しているHTMLファイルです。

技術的詳細

このコミットは、doc/install.html ファイルに対して、Windows環境でのGoのインストール手順に関する記述を大幅に加筆・修正しています。

主な変更点は以下の通りです。

  1. Goのインストールパスに関する説明の明確化: 既存のドキュメントでは、Goが /usr/local/go にインストールされることを前提としていましたが、Windows環境では c:\Go が一般的なインストールパスであることを追記し、異なる場所にインストールした場合の GOROOT 設定の必要性を強調しています。
  2. Windows環境変数設定へのリンク追加: Windowsユーザー向けに、環境変数の設定方法に関するセクションへのアンカーリンク (#windows_env) を追加し、ユーザーが関連情報にアクセスしやすくしています。
  3. Windowsインストールオプションの明確化: WindowsにおけるGoのインストール方法として、MSIインストーラーとzipアーカイブの2つの主要なオプションがあることを明記しています。
  4. MSIインストーラーの説明: MSIインストーラーを使用した場合のデフォルトインストールパス (c:\Go) や、インストーラーが自動的に c:\Go\binPATH に追加することについて説明しています。
  5. Zipアーカイブインストール手順の詳細化:
    • zipファイルを展開する推奨ディレクトリとして c:\Go を提示しています。
    • c:\Go 以外のディレクトリに展開した場合、GOROOT 環境変数を手動で設定する必要があることを明確に指示しています。
    • Goのbinディレクトリ(例: c:\Go\bin)を PATH 環境変数に追加する手順を説明しています。
  6. Windowsでの環境変数設定方法のセクション追加: 「Setting environment variables under Windows」という新しいセクション (#windows_env) を設け、Windowsの「システムのプロパティ」にある「環境変数」ボタンを通じて設定する方法を具体的に説明しています。これにより、Windowsユーザーが環境変数を設定する際の一般的な手順を網羅しています。

これらの変更により、WindowsユーザーがGoをインストールする際に、特にzipアーカイブを使用する場合の環境設定に関する混乱を解消し、より正確で分かりやすいガイダンスを提供することを目指しています。

コアとなるコードの変更箇所

diff --git a/doc/install.html b/doc/install.html
index 83e98bd0d3..909f82fd4a 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -51,7 +51,8 @@ OS/arch combination you may want to try
 
 <p>
 The Go binary distributions assume they will be installed in
-<code>/usr/local/go</code>, but it is possible to install them in a different
+<code>/usr/local/go</code> (or <code>c:\\Go</code> under Windows),\n+but it is possible to install them in a different
 location. If you do this, you will need to set the <code>GOROOT</code>
 environment variable to that directory when using the Go tools.
 </p>
@@ -66,6 +67,11 @@ export GOROOT=$HOME/go
 export PATH=$PATH:$GOROOT/bin
 </pre>
 
+<p>
+Windows users should read the section about <a href=\"#windows_env\">setting\n+environment variables under Windows</a>.\n+</p>\n+\n <h3 id=\"freebsd_linux\">FreeBSD and Linux</h3>
 
 <p>
 Open the <code>.msi</code> file and follow the prompts to install the Go tools.\n By default, the installer puts the Go distribution in <code>c:\\Go</code>.\n@@ -124,6 +139,31 @@ The installer should put the <code>c:\\Go\\bin</code> directory in your
 command prompts for the change to take effect.\n </p>\n \n+<h4 id=\"windows_zip\">Zip archive</h3>\n+\n+<p>\n+Extract the <code>.zip</code> file to the directory of your choice (we\n+suggest <code>c:\\Go</code>).\n+</p>\n+\n+<p>\n+If you chose a directory other than <code>c:\\Go</code>, you must set\n+the <code>GOROOT</code> environment variable to your chosen path.\n+</p>\n+\n+<p>\n+Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\\Go\\bin</code>) to to your <code>PATH</code> environment variable.\n+</p>\n+\n+<h4 id=\"windows_env\">Setting environment variables under Windows</h4>\n+\n+<p>\n+Under Windows, you may set environment variables through the \"Environment\n+Variables\" button on the \"Advanced\" tab of the \"System\" control panel. Some\n+versions of Windows provide this control panel through the \"Advanced System\n+Settings\" option inside the \"System\" control panel.\n+</p>\n+\n <h2 id=\"testing\">Testing your installation</h2>
 
 <p>

コアとなるコードの解説

上記のdiffは、doc/install.htmlファイルに対する変更を示しています。

  • 行 51-52 の変更:

    -<code>/usr/local/go</code>, but it is possible to install them in a different
    +<code>/usr/local/go</code> (or <code>c:\\Go</code> under Windows),\n+but it is possible to install them in a different
    

    Goのバイナリ配布がデフォルトでインストールされるパスについて、Windows環境での一般的なパスである c:\Go が追記されました。これにより、ドキュメントがよりWindowsユーザーの状況に即したものになっています。

  • 行 66-70 の追加:

    +<p>
    +Windows users should read the section about <a href=\"#windows_env\">setting\n+environment variables under Windows</a>.\n+</p>\n+\n```
    Goの環境変数設定に関する一般的な説明の後に、Windowsユーザー向けに特化した環境変数設定のセクションへのリンクが追加されました。これは、Windowsでの環境変数設定が他のOSと異なるため、ユーザーが適切な情報に素早くアクセスできるようにするための配慮です。
    
    
  • 行 113-119 の追加:

    +<h3 id=\"windows\">Windows</h3>\n+\n+<p>\n+The Go project provides two installation options for Windows users\n+(besides <a href=\"/doc/install/source\">installing from source</a>):\n+an MSI installer that configures your installation automatically,\n+and a zip archive that requires you to set some environment variables.\n+</p>\n+\n+<h4 id=\"windows_msi\">MSI installer</h3>\n+\n```
    Windowsセクションの冒頭に、Goのインストール方法としてMSIインストーラーとzipアーカイブの2つの主要な選択肢があることが明記されました。これにより、ユーザーは自身のニーズに合ったインストール方法を選択できるようになります。
    
    
  • 行 124-151 の追加:

    +<h4 id=\"windows_zip\">Zip archive</h3>\n+\n+<p>\n+Extract the <code>.zip</code> file to the directory of your choice (we\n+suggest <code>c:\\Go</code>).\n+</p>\n+\n+<p>\n+If you chose a directory other than <code>c:\\Go</code>, you must set\n+the <code>GOROOT</code> environment variable to your chosen path.\n+</p>\n+\n+<p>\n+Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\\Go\\bin</code>) to to your <code>PATH</code> environment variable.\n+</p>\n+\n+<h4 id=\"windows_env\">Setting environment variables under Windows</h4>\n+\n+<p>\n+Under Windows, you may set environment variables through the \"Environment\n+Variables\" button on the \"Advanced\" tab of the \"System\" control panel. Some\n+versions of Windows provide this control panel through the \"Advanced System\n+Settings\" option inside the \"System\" control panel.\n+</p>\n+\n```
    この部分がこのコミットの最も重要な変更点です。
    *   `windows_zip` という新しいセクションが追加され、zipアーカイブからのインストール手順が詳細に説明されています。これには、zipファイルの展開場所の推奨、`GOROOT` の設定が必要なケース、そして `PATH` 環境変数に `c:\Go\bin` を追加する方法が含まれます。
    *   `windows_env` という新しいセクションが追加され、Windowsで環境変数を設定するための具体的なGUI操作手順が説明されています。これは、Windowsの「システムのプロパティ」から「環境変数」を開く方法を案内しており、ユーザーが手動で環境変数を設定する際の障壁を低減します。
    
    

これらの変更は、Goのインストールプロセス、特にWindows環境における手動でのセットアップに関するドキュメントの網羅性と明確性を大幅に向上させています。

関連リンク

参考にした情報源リンク