From cd75735eb83a4eb5c405ec1336cd60f39abb54d9 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 27 May 2025 17:28:03 +0900 Subject: [PATCH] go/analysis: expose GoMod to Pass.Module go.mod (w/ go.sum in the same dir) is needed by https://github.com/AkihiroSuda/gosocialcheck to check the reputation of dependencies. Fixes golang/go#73878 Signed-off-by: Akihiro Suda --- go/analysis/analysis.go | 1 + go/analysis/checker/checker.go | 1 + 2 files changed, 2 insertions(+) diff --git a/go/analysis/analysis.go b/go/analysis/analysis.go index a7df4d1fe4e..382917bd5c9 100644 --- a/go/analysis/analysis.go +++ b/go/analysis/analysis.go @@ -252,5 +252,6 @@ type Fact interface { type Module struct { Path string // module path Version string // module version ("" if unknown, such as for workspace modules) + GoMod string // path to go.mod file used when loading this module, if any GoVersion string // go version used in module (e.g. "go1.22.0") } diff --git a/go/analysis/checker/checker.go b/go/analysis/checker/checker.go index 94808733b9d..9555b2ab27d 100644 --- a/go/analysis/checker/checker.go +++ b/go/analysis/checker/checker.go @@ -321,6 +321,7 @@ func (act *Action) execOnce() { if mod := act.Package.Module; mod != nil { module.Path = mod.Path module.Version = mod.Version + module.GoMod = mod.GoMod module.GoVersion = mod.GoVersion }