cmd/go/tidy: fix incorrect message on no modules

This commit is contained in:
ChandanChainani 2023-03-18 16:02:42 +05:30
parent 4ebf10f829
commit 9b24ca75be
1 changed files with 4 additions and 4 deletions

View File

@ -340,10 +340,6 @@ func LoadPackages(ctx context.Context, opts PackageOpts, patterns ...string) (ma
initialRS := LoadModFile(ctx)
if len(initialRS.rootModules) == 0 {
return matches, loadedPackages
}
ld := loadFromRoots(ctx, loaderParams{
PackageOpts: opts,
requirements: initialRS,
@ -359,6 +355,10 @@ func LoadPackages(ctx context.Context, opts PackageOpts, patterns ...string) (ma
},
})
if len(ld.requirements.rootModules) == 0 {
return matches, loadedPackages
}
// One last pass to finalize wildcards.
updateMatches(ld.requirements, ld)