Documentation ¶
Overview ¶
Package mod provides core features related to go.mod file handling for use by Go editors and tools.
Copyright 2023 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- func CodeLensSources() map[settings.CodeLensSource]cache.CodeLensSourceFunc
- func Format(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) ([]protocol.TextEdit, error)
- func Hover(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, ...) (*protocol.Hover, error)
- func InlayHint(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, ...) ([]protocol.InlayHint, error)
- func ModParseDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (diagnostics []*cache.Diagnostic, err error)
- func ModTidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) ([]*cache.Diagnostic, error)
- func ModUpgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (upgradeDiagnostics []*cache.Diagnostic, err error)
- func ModVulnerabilityDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (vulnDiagnostics []*cache.Diagnostic, err error)
- func ParseDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
- func SelectUpgradeCodeActions(actions []protocol.CodeAction) []protocol.CodeAction
- func TidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
- func UpgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
- func VulnerabilityDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeLensSources ¶ added in v0.16.0
func CodeLensSources() map[settings.CodeLensSource]cache.CodeLensSourceFunc
CodeLensSources returns the sources of code lenses for go.mod files.
func ModParseDiagnostics ¶
func ModParseDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (diagnostics []*cache.Diagnostic, err error)
ModParseDiagnostics reports diagnostics from parsing the mod file.
func ModTidyDiagnostics ¶
func ModTidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) ([]*cache.Diagnostic, error)
ModTidyDiagnostics reports diagnostics from running go mod tidy.
func ModUpgradeDiagnostics ¶
func ModUpgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (upgradeDiagnostics []*cache.Diagnostic, err error)
ModUpgradeDiagnostics adds upgrade quick fixes for individual modules if the upgrades are recorded in the view.
func ModVulnerabilityDiagnostics ¶
func ModVulnerabilityDiagnostics(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) (vulnDiagnostics []*cache.Diagnostic, err error)
ModVulnerabilityDiagnostics adds diagnostics for vulnerabilities in individual modules if the vulnerability is recorded in the view.
func ParseDiagnostics ¶
func ParseDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
ParseDiagnostics returns diagnostics from parsing the go.mod files in the workspace.
func SelectUpgradeCodeActions ¶
func SelectUpgradeCodeActions(actions []protocol.CodeAction) []protocol.CodeAction
SelectUpgradeCodeActions takes a list of code actions for a required module and returns a more selective list of upgrade code actions, where the code actions have been deduped. Code actions unrelated to upgrade are deduplicated by the name.
func TidyDiagnostics ¶
func TidyDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
Diagnostics returns diagnostics from running go mod tidy.
func UpgradeDiagnostics ¶
func UpgradeDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
UpgradeDiagnostics returns upgrade diagnostics for the modules in the workspace with known upgrades.
func VulnerabilityDiagnostics ¶
func VulnerabilityDiagnostics(ctx context.Context, snapshot *cache.Snapshot) (map[protocol.DocumentURI][]*cache.Diagnostic, error)
VulnerabilityDiagnostics returns vulnerability diagnostics for the active modules in the workspace with known vulnerabilities.
Types ¶
This section is empty.