Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions internal/fetchdatasource/fetchdatasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,19 @@ func (ds *FetchDataSource) fetch(ctx context.Context, modulePath, version string
return nil, nil, fmt.Errorf("%s@%s: %w", modulePath, version, derrors.NotFound)
}

func (ds *FetchDataSource) populateUnitSubdirectories(u *internal.Unit, m *fetch.LazyModule) {
func (ds *FetchDataSource) populateUnitSubdirectories(ctx context.Context, u *internal.Unit, m *fetch.LazyModule) {
p := u.Path + "/"
for _, u2 := range m.UnitMetas {
if strings.HasPrefix(u2.Path, p) || u.Path == "std" {
var synopsis string
if sub, err := m.Unit(ctx, u2.Path); err == nil && len(sub.Documentation) > 0 {
synopsis = sub.Documentation[0].Synopsis
}
u.Subdirectories = append(u.Subdirectories, &internal.PackageMeta{
Path: u2.Path,
Name: u2.Name,
// Syn, IsRedistributable, and Licences are not populated from FetchDataSource.
// IsRedistributable, and Licences are not populated from FetchDataSource.
Synopsis: synopsis,
})
}
}
Expand Down Expand Up @@ -234,7 +239,7 @@ func (ds *FetchDataSource) findUnit(ctx context.Context, m *fetch.LazyModule, pa
if err != nil {
return nil, err
}
ds.populateUnitSubdirectories(unit, m)
ds.populateUnitSubdirectories(ctx, unit, m)
if ds.opts.BypassLicenseCheck {
unit.IsRedistributable = true
} else {
Expand Down