Documentation
¶
Overview ¶
Package workspace holds the checks made of a workspace as a whole rather than of one document: how the documents it holds fit together, which no document's own analysis sees. Each finding is a diagnostic attached to the document it is best acted on in, reported once per workspace.
Index ¶
Constants ¶
const CodeLibraryDeclaredTwice = "library-declared-twice"
CodeLibraryDeclaredTwice is the code of the warning that two documents in the workspace declare the same library package.
const Source = "workspace"
Source is the Source every finding of this package carries.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finding ¶
type Finding struct {
// Document is the document the diagnostic is reported in: the one holding
// the declaration references do not resolve to, where removing or renaming
// it resolves the finding. Its span lies in that document's text.
Document string
// Library reports whether Document is a library document (bundled, or
// loaded from the library path) rather than one of the workspace's own,
// whose text the workspace does not hold.
Library bool
// Used is the document whose declarations references resolve to.
Used string
// Packages are the duplicated library packages, sorted.
Packages []string
Diagnostic diag.Diagnostic
}
Finding is one workspace-level diagnostic.
func DuplicateLibraries ¶
DuplicateLibraries reports the library packages the index holds more than one declaration of. Two documents declaring the same `library package` — two copies of the standard library under the workspace folder or the library path, or a user library vendored twice — leave every reference to it resolving to one copy (the first the index registered) with the other silently unused. The findings are grouped by the pair of trees the copies lie in, so two copies of the whole standard library are one warning, not one per file.