Skip to content

Commit

Permalink
Switching to string instead of uint64
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Schendel <[email protected]>
  • Loading branch information
amitschendel committed Jan 28, 2025
1 parent e6f6cb5 commit bc77942
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 118 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/softwarecomposition/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ type IdentifiedCallStack struct {
}

type StackFrame struct {
FileID uint64
Lineno uint64
FileID string
Lineno string
}

type CallStackNode struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/softwarecomposition/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ type IdentifiedCallStack struct {
}

type StackFrame struct {
FileID uint64 `json:"fileID" protobuf:"bytes,1,opt,name=fileID"`
Lineno uint64 `json:"lineno" protobuf:"bytes,2,opt,name=lineno"`
FileID string `json:"fileID" protobuf:"bytes,1,opt,name=fileID"`
Lineno string `json:"lineno" protobuf:"bytes,2,opt,name=lineno"`
}

type CallStackNode struct {
Expand Down
19 changes: 10 additions & 9 deletions pkg/registry/file/callstack/callstack_benchmark_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package callstack

import (
"strconv"
"testing"

types "github.com/kubescape/storage/pkg/apis/softwarecomposition"
Expand All @@ -16,8 +17,8 @@ func createLinearCallStack(depth int) *types.CallStack {
for i := 1; i <= depth; i++ {
newNode := &types.CallStackNode{
Frame: &types.StackFrame{
FileID: uint64(i),
Lineno: uint64(i),
FileID: strconv.Itoa(i),
Lineno: strconv.Itoa(i),
},
Children: make([]*types.CallStackNode, 0),
Parent: current,
Expand All @@ -44,8 +45,8 @@ func createBranchingCallStack(depth, width int) *types.CallStack {
for i := 0; i < width; i++ {
child := &types.CallStackNode{
Frame: &types.StackFrame{
FileID: uint64(currentDepth + 1),
Lineno: uint64(i + 1),
FileID: strconv.Itoa(currentDepth + 1),
Lineno: strconv.Itoa(i + 1),
},
Children: make([]*types.CallStackNode, 0),
Parent: node,
Expand Down Expand Up @@ -183,18 +184,18 @@ func BenchmarkFramesEqual(b *testing.B) {
},
{
name: "one_nil",
f1: &types.StackFrame{FileID: 1, Lineno: 1},
f1: &types.StackFrame{FileID: "1", Lineno: "1"},
f2: nil,
},
{
name: "equal",
f1: &types.StackFrame{FileID: 1, Lineno: 1},
f2: &types.StackFrame{FileID: 1, Lineno: 1},
f1: &types.StackFrame{FileID: "1", Lineno: "1"},
f2: &types.StackFrame{FileID: "1", Lineno: "1"},
},
{
name: "different",
f1: &types.StackFrame{FileID: 1, Lineno: 1},
f2: &types.StackFrame{FileID: 2, Lineno: 2},
f1: &types.StackFrame{FileID: "1", Lineno: "1"},
f2: &types.StackFrame{FileID: "1", Lineno: "1"},
},
}

Expand Down
Loading

0 comments on commit bc77942

Please sign in to comment.