This CL deletes unreferenced declarations and unexports
some unnecessarily public ones.

Change-Id: Ic257645c39bedfe151b92134b148ddb99bf3bf4a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619855
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Alan Donovan 2024-10-12 14:44:41 -04:00 коммит произвёл Gopher Robot
Родитель 244a31e15e
Коммит 1a5fe8307f
3 изменённых файлов: 12 добавлений и 52 удалений

Просмотреть файл

@ -31,7 +31,7 @@ func ParseDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protoc
ctx, done := event.Start(ctx, "mod.Diagnostics", snapshot.Labels()...)
defer done()
return collectDiagnostics(ctx, snapshot, ModParseDiagnostics)
return collectDiagnostics(ctx, snapshot, parseDiagnostics)
}
// Diagnostics returns diagnostics from running go mod tidy.
@ -39,7 +39,7 @@ func TidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protoco
ctx, done := event.Start(ctx, "mod.Diagnostics", snapshot.Labels()...)
defer done()
return collectDiagnostics(ctx, snapshot, ModTidyDiagnostics)
return collectDiagnostics(ctx, snapshot, tidyDiagnostics)
}
// UpgradeDiagnostics returns upgrade diagnostics for the modules in the
@ -48,7 +48,7 @@ func UpgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[prot
ctx, done := event.Start(ctx, "mod.UpgradeDiagnostics", snapshot.Labels()...)
defer done()
return collectDiagnostics(ctx, snapshot, ModUpgradeDiagnostics)
return collectDiagnostics(ctx, snapshot, upgradeDiagnostics)
}
// VulnerabilityDiagnostics returns vulnerability diagnostics for the active modules in the
@ -57,7 +57,7 @@ func VulnerabilityDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (ma
ctx, done := event.Start(ctx, "mod.VulnerabilityDiagnostics", snapshot.Labels()...)
defer done()
return collectDiagnostics(ctx, snapshot, ModVulnerabilityDiagnostics)
return collectDiagnostics(ctx, snapshot, vulnerabilityDiagnostics)
}
func collectDiagnostics(ctx context.Context, snapshot *cache.Snapshot, diagFn func(context.Context, *cache.Snapshot, file.Handle) ([]*cache.Diagnostic, error)) (map[protocol.DocumentURI][]*cache.Diagnostic, error) {
@ -94,8 +94,8 @@ func collectDiagnostics(ctx context.Context, snapshot *cache.Snapshot, diagFn fu
return reports, nil
}
// ModParseDiagnostics reports diagnostics from parsing the mod file.
func ModParseDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (diagnostics []*cache.Diagnostic, err error) {
// parseDiagnostics reports diagnostics from parsing the mod file.
func parseDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (diagnostics []*cache.Diagnostic, err error) {
pm, err := snapshot.ParseMod(ctx, fh)
if err != nil {
if pm == nil || len(pm.ParseErrors) == 0 {
@ -106,8 +106,8 @@ func ModParseDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.
return nil, nil
}
// ModTidyDiagnostics reports diagnostics from running go mod tidy.
func ModTidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) ([]*cache.Diagnostic, error) {
// tidyDiagnostics reports diagnostics from running go mod tidy.
func tidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) ([]*cache.Diagnostic, error) {
pm, err := snapshot.ParseMod(ctx, fh) // memoized
if err != nil {
return nil, nil // errors reported by ModDiagnostics above
@ -132,9 +132,9 @@ func ModTidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.H
return tidied.Diagnostics, nil
}
// ModUpgradeDiagnostics adds upgrade quick fixes for individual modules if the upgrades
// upgradeDiagnostics adds upgrade quick fixes for individual modules if the upgrades
// are recorded in the view.
func ModUpgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (upgradeDiagnostics []*cache.Diagnostic, err error) {
func upgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (upgradeDiagnostics []*cache.Diagnostic, err error) {
pm, err := snapshot.ParseMod(ctx, fh)
if err != nil {
// Don't return an error if there are parse error diagnostics to be shown, but also do not
@ -177,9 +177,9 @@ func ModUpgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh fil
const upgradeCodeActionPrefix = "Upgrade to "
// ModVulnerabilityDiagnostics adds diagnostics for vulnerabilities in individual modules
// vulnerabilityDiagnostics adds diagnostics for vulnerabilities in individual modules
// if the vulnerability is recorded in the view.
func ModVulnerabilityDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (vulnDiagnostics []*cache.Diagnostic, err error) {
func vulnerabilityDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (vulnDiagnostics []*cache.Diagnostic, err error) {
pm, err := snapshot.ParseMod(ctx, fh)
if err != nil {
// Don't return an error if there are parse error diagnostics to be shown, but also do not

Просмотреть файл

@ -506,22 +506,6 @@ type RunVulncheckResult struct {
Token protocol.ProgressToken
}
// CallStack models a trace of function calls starting
// with a client function or method and ending with a
// call to a vulnerable symbol.
type CallStack []StackEntry
// StackEntry models an element of a call stack.
type StackEntry struct {
// See golang.org/x/exp/vulncheck.StackEntry.
// User-friendly representation of function/method names.
// e.g. package.funcName, package.(recvType).methodName, ...
Name string
URI protocol.DocumentURI
Pos protocol.Position // Start position. (0-based. Column is always 0)
}
// MemStatsResult holds selected fields from runtime.MemStats.
type MemStatsResult struct {
HeapAlloc uint64

Просмотреть файл

@ -128,30 +128,6 @@ func (v Version) Canonical() string {
return strings.TrimPrefix(semver.Canonical(v.V()), "v")
}
// Reference type is a reference (link) type.
type ReferenceType string
const (
ReferenceTypeAdvisory = ReferenceType("ADVISORY")
ReferenceTypeArticle = ReferenceType("ARTICLE")
ReferenceTypeReport = ReferenceType("REPORT")
ReferenceTypeFix = ReferenceType("FIX")
ReferenceTypePackage = ReferenceType("PACKAGE")
ReferenceTypeEvidence = ReferenceType("EVIDENCE")
ReferenceTypeWeb = ReferenceType("WEB")
)
// ReferenceTypes is the set of reference types defined in OSV.
var ReferenceTypes = []ReferenceType{
ReferenceTypeAdvisory,
ReferenceTypeArticle,
ReferenceTypeReport,
ReferenceTypeFix,
ReferenceTypePackage,
ReferenceTypeEvidence,
ReferenceTypeWeb,
}
// A Reference is a link to some external resource.
//
// For ease of typing, References are represented in the YAML as a