-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
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 toolProposalProposal-AcceptedToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Description
Background: When using inspector.Cursor, It is often necessary to check whether a cursor is valid. This can be done by comparing it to the zero value, or by testing whether its Inspector field is nil:
if cur != (Cursor{}) { use(cur) }
if cur.Inspector() != nil { use(cur) }However, both are rather roundabout, and the second is unclear.
Proposal: we propose to add a Valid method that reports this property directly:
package inspector // golang.org/x/tools/go/ast/inspector
type Cursor ...
// Valid reports whether the cursor is valid.
func (Cursor) Valid() bool Reactions are currently unavailable
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 toolProposalProposal-AcceptedToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Type
Projects
Status
Accepted