1
0
mirror of https://github.com/mgechev/revive.git synced 2025-07-05 00:28:53 +02:00
Files
revive/internal/ifelse/target.go
2025-05-27 07:44:24 +02:00

25 lines
439 B
Go

package ifelse
import "go/ast"
// Target decides what line/column should be indicated by the rule in question.
type Target int
const (
// TargetIf means the text refers to the "if".
TargetIf Target = iota
// TargetElse means the text refers to the "else".
TargetElse
)
func (t Target) node(ifStmt *ast.IfStmt) ast.Node {
switch t {
case TargetIf:
return ifStmt
case TargetElse:
return ifStmt.Else
}
panic("bad target")
}