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

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

このコミットは、Go言語の公式ウェブサイトおよび関連ドキュメントにおける複数のHTMLリンクの修正と、godocツールが生成するパッケージリストのリンク構造の改善を目的としています。具体的には、Google App EngineのドキュメントURLがcode.google.comからdevelopers.google.comへ変更されたことに対応し、またgodocのパッケージリンクに末尾のスラッシュを追加することで、より正確なURL解決とユーザーエクスペリエンスの向上を図っています。

コミット

commit 82cbcb0dd5437db1fd2f51d1ff81a38670f7a684
Author: Dave Cheney <dave@cheney.net>
Date:   Wed Jul 11 09:41:08 2012 -0700

    website: various html fixes
    
    Fixes #3424.
    
    R=fullung, adg
    CC=golang-dev
    https://golang.org/cl/6343088

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

https://github.com/golang/go/commit/82cbcb0dd5437db1fd2f51d1ff81a38670f7a684

元コミット内容

website: various html fixes

Fixes #3424.

R=fullung, adg
CC=golang-dev
https://golang.org/cl/6343088

変更の背景

このコミットの主な背景は以下の2点です。

  1. Google App EngineドキュメントURLの変更: Googleは、その開発者向けドキュメントのホスティングプラットフォームをcode.google.comからdevelopers.google.comへと移行しました。これに伴い、Go言語の公式ウェブサイト内でGoogle App Engineに関するドキュメントやサービスへのリンクが古くなり、正しくないURLを指していました。ユーザーが最新かつ正確な情報にアクセスできるよう、これらのリンクを更新する必要がありました。
  2. godoc生成リンクの改善: godocはGo言語のドキュメント生成ツールであり、Goパッケージのドキュメントをウェブ形式で提供します。このツールが生成するパッケージへのリンクにおいて、ディレクトリを示すURLの末尾にスラッシュがない場合がありました。ウェブサーバーの挙動によっては、末尾にスラッシュがないURLはリダイレクトを引き起こしたり、相対パスの解決に問題を生じさせたりする可能性があります。一貫性のある正確なURLを提供するため、パッケージディレクトリへのリンクには末尾のスラッシュを付与する修正が必要でした。

これらの修正は、Go言語の公式ドキュメントの正確性とユーザーエクスペリエンスを向上させるために行われました。

前提知識の解説

  • Google App Engine (GAE): Googleが提供するPaaS (Platform as a Service) で、ウェブアプリケーションやモバイルバックエンドを構築・ホストするためのプラットフォームです。Go言語もGAEでサポートされており、多くのGoアプリケーションがGAE上で動作しています。GAEのドキュメントは、開発者にとって重要な情報源です。
  • godoc: Go言語に標準で付属するドキュメンテーションツールです。Goのソースコードからコメントを解析し、自動的にAPIドキュメントを生成します。godocはウェブサーバーとしても機能し、ローカルでドキュメントを閲覧したり、golang.orgのような公式ウェブサイトで公開されたドキュメントを提供したりします。
  • HTML <a> タグ: HTML (HyperText Markup Language) において、ハイパーリンクを定義するために使用される要素です。href属性にリンク先のURLを指定します。
  • URLの末尾のスラッシュ: ウェブサーバーにおいて、URLの末尾にスラッシュがあるかないかは、そのURLがファイル(例: example.com/page.html)を指すのか、それともディレクトリ(例: example.com/directory/)を指すのかを示す慣習があります。ディレクトリを指すURLに末尾のスラッシュがない場合、多くのウェブサーバーは自動的にスラッシュを追加してリダイレクトを行います。これは、相対パスの解決にも影響を与えることがあります。

技術的詳細

このコミットは、主にGo言語の公式ウェブサイトのHTMLファイルと、godocツールが使用するHTMLテンプレートファイルに対して行われました。

  1. Google App Engine関連URLの更新:
    • doc/docs.htmldoc/go_faq.htmldoc/reference.htmlの3つのファイルにおいて、Google App Engineに関連するリンクのhref属性が修正されました。
    • 変更前: http://code.google.com/appengine/...
    • 変更後: https://developers.google.com/appengine/...
    • これにより、古いドメインから新しい公式ドメインへのリンクが更新され、ユーザーが最新のApp Engineドキュメントにアクセスできるようになりました。また、プロトコルもhttpからhttpsに変更され、セキュリティが向上しています。
  2. godocパッケージリンクの末尾スラッシュ追加:
    • lib/godoc/package.htmlファイルは、godocがパッケージリストを生成する際に使用するGoテンプレートです。
    • このテンプレート内で、パッケージへのリンクを生成する箇所が修正されました。
    • 変更前: <a href=\"{{html .Path}}\">{{html .Path}}</a> および <a href=\"{{html .Path}}\">{{html .Name}}</a>
    • 変更後: <a href=\"{{html .Path}}/\">{{html .Path}}</a> および <a href=\"{{html .Path}}/\">{{html .Name}}</a>
    • {{html .Path}}はパッケージのパスを表す変数であり、これに/を追加することで、生成されるURLの末尾にスラッシュが強制的に付与されるようになりました。これにより、godocが生成するパッケージディレクトリへのリンクが常に末尾スラッシュを持つようになり、URLの解決の一貫性と正確性が保証されます。

これらの変更は、Go言語のドキュメントエコシステム全体の健全性とユーザーエクスペリエンスの向上に貢献しています。

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

--- a/doc/docs.html
+++ b/doc/docs.html
@@ -56,10 +56,10 @@ A must read for any new Go programmer. It augments the tour and
 the language specification, both of which should be read first.
 </p>
 
-<h3 id=\"appengine\"><a href=\"http://code.google.com/appengine/docs/go/gettingstarted/\">Getting Started with Go on App Engine</a></h3>
+<h3 id=\"appengine\"><a href=\"https://developers.google.com/appengine/docs/go/gettingstarted/\">Getting Started with Go on App Engine</a></h3>
 <p>
 How to develop and deploy a simple Go project with
-<a href=\"http://code.google.com/appengine/\">Google App Engine</a>.
+<a href=\"https://developers.google.com/appengine/\">Google App Engine</a>.
 </p>
 
 <h3 id=\"go_faq\"><a href=\"go_faq.html\">Frequently Asked Questions (FAQ)</a></h3>
diff --git a/doc/go_faq.html b/doc/go_faq.html
index b5b7cc656d..17dc54f7b4 100644
--- a/doc/go_faq.html
+++ b/doc/go_faq.html
@@ -180,7 +180,7 @@ production inside Google.  A public example is the server behind
 <a href=\"http://golang.org\">http://golang.org</a>.
 It\'s just the <a href=\"/cmd/godoc\"><code>godoc</code></a>
 document server running in a production configuration on
-<a href=\"http://code.google.com/appengine/\">Google App Engine</a>.
+<a href=\"https://developers.google.com/appengine/\">Google App Engine</a>.
 </p>
 
 <h3 id=\"Do_Go_programs_link_with_Cpp_programs\">\
diff --git a/doc/reference.html b/doc/reference.html
index beaac431d2..70df557f08 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -24,10 +24,10 @@ The documentation for the Go tools.\n The official Go Language specification. \n </p>\n \n-<h3 id=\"appengine\"><a href=\"http://code.google.com/appengine/docs/go/\">App Engine Go Runtime Documentation</a></h3>\n+<h3 id=\"appengine\"><a href=\"https://developers.google.com/appengine/docs/go/\">App Engine Go Runtime Documentation</a></h3>\n <p>\n The documentation for\n-<a href=\"http://code.google.com/appengine/\">Google App Engine</a>\'s Go runtime.\n+<a href=\"https://developers.google.com/appengine/\">Google App Engine</a>\'s Go runtime.\n </p>\n \n <h3 id=\"go_mem\"><a href=\"/ref/mem\">The Go Memory Model</a></h3>\
diff --git a/lib/godoc/godoc.html b/lib/godoc/godoc.html
index 5330b17d4b..d4bc4b84d8 100644
--- a/lib/godoc/godoc.html
+++ b/lib/godoc/godoc.html
@@ -57,7 +57,7 @@ the content of this page is licensed under the\n Creative Commons Attribution 3.0 License,\n and code is licensed under a <a href=\"/LICENSE\">BSD license</a>.<br>\n <a href=\"/doc/tos.html\">Terms of Service</a> | \n-<a href=\"http://www.google.com/intl/en/privacy/privacy-policy.html\">Privacy Policy</a>\n+<a href=\"http://www.google.com/intl/en/policies/privacy/\">Privacy Policy</a>\n </div>\n \n </body>\
diff --git a/lib/godoc/package.html b/lib/godoc/package.html
index 5b7fce8d70..e037072211 100644
--- a/lib/godoc/package.html
+++ b/lib/godoc/package.html
@@ -192,14 +192,14 @@\n \t\t{{if $.DirFlat}}\n \t\t\t{{if .HasPkg}}\n \t\t\t\t<tr>\n-\t\t\t\t<td class=\"name\"><a href=\"{{html .Path}}\">{{html .Path}}</a></td>\n+\t\t\t\t<td class=\"name\"><a href=\"{{html .Path}}/\">{{html .Path}}</a></td>\n \t\t\t\t<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>\n \t\t\t\t<td style=\"width: auto\">{{html .Synopsis}}</td>\n \t\t\t\t</tr>\n \t\t\t{{end}}\n \t\t{{else}}\n \t\t\t<tr>\n-\t\t\t<td class=\"name\">{{repeat `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;` .Depth}}<a href=\"{{html .Path}}\">{{html .Name}}</a></td>\n+\t\t\t<td class=\"name\">{{repeat `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;` .Depth}}<a href=\"{{html .Path}}/\">{{html .Name}}</a></td>\n \t\t\t<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>\n \t\t\t<td style=\"width: auto\">{{html .Synopsis}}</td>\n \t\t\t</tr>\

コアとなるコードの解説

  • doc/docs.html, doc/go_faq.html, doc/reference.html: これらのファイルはGo言語の公式ウェブサイトのドキュメントページの一部です。変更は、Google App Engineに関連するリンクのhref属性を更新することに集中しています。

    • http://code.google.com/appengine/docs/go/gettingstarted/ から https://developers.google.com/appengine/docs/go/gettingstarted/
    • http://code.google.com/appengine/ から https://developers.google.com/appengine/
    • http://code.google.com/appengine/docs/go/ から https://developers.google.com/appengine/docs/go/ へ これらの変更により、ユーザーは常に最新のGoogle App Engineドキュメントにリダイレクトされることなく直接アクセスできるようになります。また、httpからhttpsへの変更は、セキュリティのベストプラクティスに沿ったものです。
  • lib/godoc/godoc.html: このファイルはgodocツールが生成するHTMLドキュメントのフッター部分に含まれるテンプレートです。変更は、Googleのプライバシーポリシーへのリンクを更新しています。

    • http://www.google.com/intl/en/privacy/privacy-policy.html から http://www.google.com/intl/en/policies/privacy/ へ これは、GoogleのプライバシーポリシーページのURL変更に対応したものです。
  • lib/godoc/package.html: このファイルはgodocツールがパッケージリストを表示する際に使用するHTMLテンプレートです。

    • {{html .Path}} の後に / を追加:
      • <a href=\"{{html .Path}}\">{{html .Path}}</a><a href=\"{{html .Path}}/\">{{html .Path}}</a>
      • <a href=\"{{html .Path}}\">{{html .Name}}</a><a href=\"{{html .Path}}/\">{{html .Name}}</a> に この修正は、godocが生成するパッケージディレクトリへのリンクに常に末尾のスラッシュを付与することを保証します。これにより、ウェブサーバーがディレクトリとして認識し、リダイレクトなしで正しく処理できるようになります。これは、特に相対パスの解決において重要であり、ユーザーが期待する動作を保証します。

関連リンク

参考にした情報源リンク

  • Google App EngineのドキュメントURL変更に関する情報:
  • godocにおけるパスと末尾スラッシュの挙動に関する一般的な情報:
    • Goのnet/httpパッケージにおけるURLルーティングと末尾スラッシュの扱いに関する一般的なウェブサーバーの慣習。
    • Goのpathパッケージのドキュメント(直接的な関連はないが、パス処理の一般的な挙動の理解に役立つ)。
    • ウェブサーバーにおけるURLの末尾スラッシュの重要性に関する一般的なウェブ開発の知識。