github.com/anchore/syft@v1.38.2/syft/file/search_result.go (about)

     1  package file
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // SearchResult represents a match found during content scanning, such as secret detection.
     8  type SearchResult struct {
     9  	// Classification identifies the type or category of the matched content.
    10  	Classification string `json:"classification"`
    11  
    12  	// LineNumber is the 1-indexed line number where the match was found.
    13  	LineNumber int64 `json:"lineNumber"`
    14  
    15  	// LineOffset is the character offset from the start of the line where the match begins.
    16  	LineOffset int64 `json:"lineOffset"`
    17  
    18  	// SeekPosition is the absolute byte offset from the start of the file.
    19  	SeekPosition int64 `json:"seekPosition"`
    20  
    21  	// Length is the size in bytes of the matched content.
    22  	Length int64 `json:"length"`
    23  
    24  	// Value optionally contains the actual matched content.
    25  	Value string `json:"value,omitempty"`
    26  }
    27  
    28  func (s SearchResult) String() string {
    29  	return fmt.Sprintf("SearchResult(classification=%q seek=%q length=%q)", s.Classification, s.SeekPosition, s.Length)
    30  }