syft/syft/file/search_result.go
Will Murphy 26e87c7cd3
fix format string in search results (#4775)
Passing '%q' to format strings for integer types is a go vet error in
recent go versions, and likely a bug.

Signed-off-by: Will Murphy <willmurphyscode@users.noreply.github.com>
2026-04-14 12:59:44 -04:00

31 lines
976 B
Go

package file
import (
"fmt"
)
// SearchResult represents a match found during content scanning, such as secret detection.
type SearchResult struct {
// Classification identifies the type or category of the matched content.
Classification string `json:"classification"`
// LineNumber is the 1-indexed line number where the match was found.
LineNumber int64 `json:"lineNumber"`
// LineOffset is the character offset from the start of the line where the match begins.
LineOffset int64 `json:"lineOffset"`
// SeekPosition is the absolute byte offset from the start of the file.
SeekPosition int64 `json:"seekPosition"`
// Length is the size in bytes of the matched content.
Length int64 `json:"length"`
// Value optionally contains the actual matched content.
Value string `json:"value,omitempty"`
}
func (s SearchResult) String() string {
return fmt.Sprintf("SearchResult(classification=%q seek=%d length=%d)", s.Classification, s.SeekPosition, s.Length)
}