go doc
とgodoc
の違い
1.使用方法:
-
go doc
: コマンドラインで直接使用 -
godoc
: ウェブサーバーを起動し、ブラウザで閲覧
2.機能:
-
go doc
: シンプルなドキュメント表示 -
godoc
: 詳細なドキュメント表示、ソースコードリンク、検索機能
3.インストール:
-
go doc
: Go標準ツールチェーンに含まれる -
godoc
: Go標準ツールチェーンに含まれる
4.用途:
-
go doc
: 素早い情報確認 -
godoc
: 包括的なドキュメント閲覧
5.出力形式:
-
go doc
: テキスト形式 -
godoc
: HTML形式(ブラウザで表示)
go doc
の例
1.パッケージのドキュメントを表示:
go doc fmt
2.特定の関数のドキュメントを表示:
go doc fmt.Println
3.特定の型のドキュメントを表示:
go doc time.Time
godoc
の例
1.ウェブサーバーを起動 (デフォルトポート6060):
godoc -http=:6060
2.カスタムポートでウェブサーバーを起動:
godoc -http=:8080