github.com/alecthomas/golangci-lint@v1.4.2-0.20180609094924-581a3564ff68/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
    15  	HunkPos   int
    16  }
    17  
    18  func (i Issue) FilePath() string {
    19  	return i.Pos.Filename
    20  }
    21  
    22  func (i Issue) Line() int {
    23  	return i.Pos.Line
    24  }
    25  
    26  func (i Issue) GetLineRange() Range {
    27  	if i.LineRange.From == 0 {
    28  		return Range{
    29  			From: i.Line(),
    30  			To:   i.Line(),
    31  		}
    32  	}
    33  
    34  	return i.LineRange
    35  }