github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/doc/dirs.go (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 // Dirは、予想されるインポートパスとファイルシステムディレクトリを指定して、コードを保持するディレクトリを記述します。 8 type Dir struct { 9 importPath string 10 dir string 11 inModule bool 12 } 13 14 // Dirsはディレクトリツリーをスキャンするための構造体です。 15 // そのNextメソッドは次に見つかったGoソースディレクトリを返します。 16 // ツリーを複数回スキャンするために使用できますが、 17 // ツリーを一度だけ走査して、見つけたデータをキャッシュします。 18 type Dirs struct { 19 scan chan Dir 20 hist []Dir 21 offset int 22 } 23 24 // Resetはスキャンを最初に戻します。 25 func (d *Dirs) Reset() 26 27 // Nextはスキャン中の次のディレクトリを返します。ブール値がfalseの場合、スキャンが完了しています。 28 func (d *Dirs) Next() (Dir, bool)