gitee.com/LaomoBK/golangci-lint@v1.10.1/pkg/result/issue.go (about) 1 package result 2 3 import "go/token" 4 5 type Range struct { 6 From, To int 7 } 8 9 type Issue struct { 10 FromLinter string 11 Text string 12 13 Pos token.Position 14 LineRange *Range `json:",omitempty"` 15 HunkPos int `json:",omitempty"` 16 17 SourceLines []string 18 } 19 20 func (i Issue) FilePath() string { 21 return i.Pos.Filename 22 } 23 24 func (i Issue) Line() int { 25 return i.Pos.Line 26 } 27 28 func (i Issue) Column() int { 29 return i.Pos.Column 30 } 31 32 func (i Issue) GetLineRange() Range { 33 if i.LineRange == nil { 34 return Range{ 35 From: i.Line(), 36 To: i.Line(), 37 } 38 } 39 40 if i.LineRange.From == 0 { 41 return Range{ 42 From: i.Line(), 43 To: i.Line(), 44 } 45 } 46 47 return *i.LineRange 48 }