mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add GOOS and GOARCH to nogo findings.
PiperOrigin-RevId: 511689371
This commit is contained in:
committed by
gVisor bot
parent
05d60444e0
commit
2f9fabe0ac
@@ -453,6 +453,8 @@ func (i *importer) checkPackage(path string, srcs []string) (*types.Package, Fin
|
||||
Category: a.Name,
|
||||
Position: i.fset.Position(d.Pos),
|
||||
Message: d.Message,
|
||||
GOOS: flags.GOOS,
|
||||
GOARCH: flags.GOARCH,
|
||||
})
|
||||
},
|
||||
ImportPackageFact: func(pkg *types.Package, ptr analysis.Fact) bool {
|
||||
@@ -609,6 +611,8 @@ func (i *importer) checkPackage(path string, srcs []string) (*types.Package, Fin
|
||||
Category: a.Name,
|
||||
Position: token.Position{Filename: filename},
|
||||
Message: errs[a].Error(),
|
||||
GOOS: flags.GOOS,
|
||||
GOARCH: flags.GOARCH,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -29,11 +29,18 @@ type Finding struct {
|
||||
Category string
|
||||
Position token.Position
|
||||
Message string
|
||||
GOARCH string
|
||||
GOOS string
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.String.
|
||||
func (f *Finding) String() string {
|
||||
return fmt.Sprintf("%s: %s: %s", f.Category, f.Position.String(), f.Message)
|
||||
if f.GOARCH == "" && f.GOOS == "" {
|
||||
// Use the legacy simplified string.
|
||||
return fmt.Sprintf("%s: %s: %s", f.Category, f.Position.String(), f.Message)
|
||||
}
|
||||
// Use the more complete information.
|
||||
return fmt.Sprintf("%s: %s: %s (GOOARCH=%s, GOOS=%s)", f.Category, f.Position.String(), f.Message, f.GOARCH, f.GOOS)
|
||||
}
|
||||
|
||||
// FindingSet is a collection of findings.
|
||||
|
||||
Reference in New Issue
Block a user