-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal
Milestone
Description
Background: Since go1.16 (#42290), go/types has internally recorded three positions (start, pos, and end) for type errors. However, only the Pos field is exposed. The x/tools repo has long resorted to unsavory hacks such as reading the non-exported fields, and using heuristics on the source text (!) to guess the end position.
Proposal: We propose to publish the Start and End fields.
package types
type Error struct {
Fset *token.FileSet // file set for interpretation of Pos
// Invariant: Start <= Pos < End || Start == Pos == End.
Pos token.Pos // error position
+ Start, End token.Pos // start, end of containing expression
Msg string // error message
Soft bool // if set, error is "soft"
}mvdan
Metadata
Metadata
Assignees
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal
Type
Projects
Status
Incoming