Skip to content

Fix Go direct dependency classification - #1876

Closed
Aayush Maini (AMaini503) wants to merge 2 commits into
microsoft:mainfrom
AMaini503:users/aamaini/go-explicit-references
Closed

Aayush Maini (AMaini503) wants to merge 2 commits into
microsoft:mainfrom
AMaini503:users/aamaini/go-explicit-references

Conversation

@AMaini503

Copy link
Copy Markdown
Contributor

Summary

  • Mark dependencies parsed from go.mod as explicitly referenced unless they have the // indirect marker.
  • Remove the incorrect assumption that dependencies inside require (...) blocks are always transitive.
  • Bump the Go detector version from 10 to 11.
  • Cover single-line and block requirements with the Go CLI both available and unavailable.

Fixes #1875

Validation

  • Ran the Microsoft.ComponentDetection.Detectors.Tests project: 968 passed, 0 failed.
  • Built the Component Detection CLI successfully.
  • Created and scanned a Go 1.24.3 module with github.com/google/uuid as a direct dependency and golang.org/x/text as an indirect dependency.
  • Confirmed the direct dependency is emitted in explicitlyReferencedComponentIds while the indirect dependency is not.

Aayush Maini added 2 commits September 21, 2026 13:30
Mark go.mod requirements as explicitly referenced unless they carry the // indirect marker.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b9f67746-b363-43ac-9c8c-764b1890c63c
Increment the detector version because explicit-reference metadata now changes for go.mod dependencies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b9f67746-b363-43ac-9c8c-764b1890c63c
@AMaini503
Aayush Maini (AMaini503) requested a review from a team as a code owner September 21, 2026 20:37
@AMaini503
Aayush Maini (AMaini503) requested review from Sebastian Gomez (sebasgomez238) and a lite review from Copilot and removed request for Copilot September 21, 2026 20:37
@AMaini503

Copy link
Copy Markdown
Contributor Author

The snapshot verification failures are expected for this change. The new scan now includes direct Go requirements (for example, \github.com/sirupsen/logrus v1.8.3 - Go) in \�xplicitlyReferencedComponentIds, while the published release snapshot has an empty explicit-reference set for that Go graph. All three platforms report this same intentional metadata difference; the remaining verification tests pass.

@AMaini503

Copy link
Copy Markdown
Contributor Author

Superseded by #1877, opened from the upstream repository branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go 1.17+ direct requirements are omitted from explicitlyReferencedComponentIds

2 participants