GetFileInfos is a convenience function that walks the ModuleReadBucket and gets all the FileInfos. Sorted by path.
(ctx context.Context, moduleReadBucket ModuleReadBucket)
| 136 | // |
| 137 | // Sorted by path. |
| 138 | func GetFileInfos(ctx context.Context, moduleReadBucket ModuleReadBucket) ([]FileInfo, error) { |
| 139 | var fileInfos []FileInfo |
| 140 | if err := moduleReadBucket.WalkFileInfos( |
| 141 | ctx, |
| 142 | func(fileInfo FileInfo) error { |
| 143 | fileInfos = append(fileInfos, fileInfo) |
| 144 | return nil |
| 145 | }, |
| 146 | ); err != nil { |
| 147 | return nil, err |
| 148 | } |
| 149 | sort.Slice( |
| 150 | fileInfos, |
| 151 | func(i int, j int) bool { |
| 152 | return fileInfos[i].Path() < fileInfos[j].Path() |
| 153 | }, |
| 154 | ) |
| 155 | return fileInfos, nil |
| 156 | } |
| 157 | |
| 158 | // GetTargetFileInfos is a convenience function that walks the ModuleReadBucket and gets |
| 159 | // all the FileInfos where IsTargetFile() is set to true. |
searching dependent graphs…