Skip to content

Commit 706592b

Browse files
committed
[gopls-release-branch.0.11] gopls/internal/vulncheck: add TODO for the vulncheck diagnostics
Change-Id: I2980cd85b4627ba44c05194ae033cae2a361454c Reviewed-on: https://go-review.googlesource.com/c/tools/+/453275 TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/tools/+/456638 Reviewed-by: Robert Findley <[email protected]>
1 parent a04d375 commit 706592b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

gopls/internal/vulncheck/command.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,26 @@ func finalDigitsIndex(s string) int {
200200
// apply to this snapshot. The result contains a set of packages,
201201
// grouped by vuln ID and by module.
202202
func vulnerablePackages(ctx context.Context, snapshot source.Snapshot, modfile source.FileHandle) (*govulncheck.Result, error) {
203+
// We want to report the intersection of vulnerable packages in the vulndb
204+
// and packages transitively imported by this module ('go list -deps all').
205+
// We use snapshot.AllValidMetadata to retrieve the list of packages
206+
// as an approximation.
207+
//
208+
// TODO(hyangah): snapshot.AllValidMetadata is a superset of
209+
// `go list all` - e.g. when the workspace has multiple main modules
210+
// (multiple go.mod files), that can include packages that are not
211+
// used by this module. Vulncheck behavior with go.work is not well
212+
// defined. Figure out the meaning, and if we decide to present
213+
// the result as if each module is analyzed independently, make
214+
// gopls track a separate build list for each module and use that
215+
// information instead of snapshot.AllValidMetadata.
203216
metadata, err := snapshot.AllValidMetadata(ctx)
204217
if err != nil {
205218
return nil, err
206219
}
207220

221+
// TODO(hyangah): handle vulnerabilities in the standard library.
222+
208223
// Group packages by modules since vuln db is keyed by module.
209224
metadataByModule := map[source.PackagePath][]*source.Metadata{}
210225
for _, md := range metadata {

0 commit comments

Comments
 (0)