Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1.6
version: latest
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/NextronSystems/finding-store
go 1.24

require (
github.com/NextronSystems/jsonlog v0.0.0-20250523073520-69e056dcf33d
github.com/NextronSystems/jsonlog v1.0.0-alpha.0.20260217085034-6cb530d8ac82
github.com/stretchr/testify v1.10.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/NextronSystems/jsonlog v0.0.0-20250523073520-69e056dcf33d h1:Lo5904HF61rzum1Md+xaQ0LsLMXb6EpzxaSPL/JRr50=
github.com/NextronSystems/jsonlog v0.0.0-20250523073520-69e056dcf33d/go.mod h1:Hk47VW018TX8o/0sxK+EJt16iRE7gB91zGZGiaAjcww=
github.com/NextronSystems/jsonlog v1.0.0-alpha.0.20260217085034-6cb530d8ac82 h1:bzUZ6Ur5bQBjII93FB2oc01An2Sei+HYdOx6MEPfxPk=
github.com/NextronSystems/jsonlog v1.0.0-alpha.0.20260217085034-6cb530d8ac82/go.mod h1:Hk47VW018TX8o/0sxK+EJt16iRE7gB91zGZGiaAjcww=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand Down
2 changes: 1 addition & 1 deletion store.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
suffixHash = ".hash"
)

func (s *Store) Store(finding *thorlog.Finding, content io.ReadSeeker) error {
func (s *Store) Store(finding *thorlog.Assessment, content io.ReadSeeker) error {
findingId := finding.Meta.GenID
if findingId == "" {
return fmt.Errorf("finding ID is empty, cannot store finding")
Expand Down
12 changes: 6 additions & 6 deletions store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestLayout(t *testing.T) {
rootDir := t.TempDir()
layout := New(rootDir)

finding := thorlog.NewFinding(thorlog.NewFile("test.txt"), "Test finding")
finding := thorlog.NewAssessment(thorlog.NewFile("test.txt"), "Test finding")
finding.Meta = thorlog.LogEventMetadata{
GenID: "abcdef1234567890",
Time: time.Now(),
Expand All @@ -47,7 +47,7 @@ func TestLayout(t *testing.T) {
assert.Equal(t, findings[0].Meta.GenID, readFinding.Meta.GenID)
}

func (s *Store) LoadFinding(id string) (*thorlog.Finding, string, error) {
func (s *Store) LoadFinding(id string) (*thorlog.Assessment, string, error) {
if len(id) < 2 {
return nil, "", fmt.Errorf("finding ID is too short, must be at least 2 characters: %s", id)
}
Expand All @@ -60,7 +60,7 @@ func (s *Store) LoadFinding(id string) (*thorlog.Finding, string, error) {
if err != nil {
return nil, "", fmt.Errorf("cannot unmarshal finding data: %w", err)
}
finding, ok := event.(*thorlog.Finding)
finding, ok := event.(*thorlog.Assessment)
if !ok {
return nil, "", fmt.Errorf("data is not a valid finding: %s", id)
}
Expand All @@ -74,7 +74,7 @@ func (s *Store) LoadFinding(id string) (*thorlog.Finding, string, error) {
return finding, string(hash), nil
}

func (s *Store) LoadContent(hash string) ([]byte, []*thorlog.Finding, error) {
func (s *Store) LoadContent(hash string) ([]byte, []*thorlog.Assessment, error) {
if len(hash) < 2 {
return nil, nil, fmt.Errorf("content hash is too short, must be at least 2 characters: %s", hash)
}
Expand All @@ -91,14 +91,14 @@ func (s *Store) LoadContent(hash string) ([]byte, []*thorlog.Finding, error) {
defer func() {
_ = metadataFile.Close()
}()
var findings []*thorlog.Finding
var findings []*thorlog.Assessment
reader := bufio.NewScanner(metadataFile)
for reader.Scan() {
event, err := parser.ParseEvent(reader.Bytes())
if err != nil {
return nil, nil, fmt.Errorf("cannot parse finding metadata: %w", err)
}
finding, ok := event.(*thorlog.Finding)
finding, ok := event.(*thorlog.Assessment)
if !ok {
return nil, nil, fmt.Errorf("metadata is not a valid finding: %s", string(reader.Bytes()))
}
Expand Down