関連記事
GitHub - devlights/blog-summary: ブログ「いろいろ備忘録日記」のまとめ
概要
以下、自分用のメモです。前回の続きです。
Go 1.25 のドラフトリリースノートは以下。
上記を見ると、Go 1.25 で go doc コマンドに -http オプションが追加されるみたいですね。
このオプションを付与すると内部でHTTPサーバが起動してブラウザでドキュメントが見れるようになります。こっちの方が見やすいことも多いので、このオプションは嬉しい。
$ go version go version go1.25rc1 linux/amd64 # オプション無し $ go doc sync.waitgroup.go package sync // import "sync" func (wg *WaitGroup) Go(f func()) Go calls f in a new goroutine and adds that task to the WaitGroup. When f returns, the task is removed from the WaitGroup. The function f must not panic. If the WaitGroup is empty, Go must happen before a WaitGroup.Wait. Typically, this simply means Go is called to start tasks before Wait is called. If the WaitGroup is not empty, Go may happen at any time. This means a goroutine started by Go may itself call Go. If a WaitGroup is reused to wait for several independent sets of tasks, new Go calls must happen after all previous Wait calls have returned. In the terminology of the Go memory model, the return from f "synchronizes before" the return of any Wait call that it unblocks. [the Go memory model]: https://go.dev/ref/mem # オプション有り $ go doc -http sync.waitgroup.go go: downloading golang.org/x/pkgsite/cmd/internal/doc v0.0.0-20250608123103-82c52f1754cd go: downloading golang.org/x/pkgsite v0.0.0-20250608123103-82c52f1754cd go: downloading golang.org/x/pkgsite v0.0.0-20250530170220-274f41854e53 go: downloading golang.org/x/mod v0.24.0 go: downloading github.com/google/safehtml v0.0.3-0.20211026203422-d6f0e11a5516 go: downloading golang.org/x/net v0.40.0 go: downloading golang.org/x/text v0.25.0 go: downloading rsc.io/markdown v0.0.0-20231214224604-88bb533a6020 go: downloading golang.org/x/sync v0.14.0 go: downloading golang.org/x/tools v0.33.0 go: downloading github.com/google/licensecheck v0.3.1 doc: Documentation server listening on addr http://localhost:42249
初回はモジュールダウンロードが入ります。その後にローカルにリスナーが起動して、そのままブラウザも起動してくれます。

参考情報
Goのおすすめ書籍
過去の記事については、以下のページからご参照下さい。
サンプルコードは、以下の場所で公開しています。