Skip to content

Commit

Permalink
fix: updated declaration syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
meganwolf0 committed Jan 14, 2025
1 parent 1dcd78f commit 296192f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/pkg/common/oscal/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,10 @@ func ComponentFromCatalog(command string, source string, catalog *oscalTypes.Cat
Version: "0.0.1",
}

return &ComponentDefinition{
Model: componentDefinition,
}, nil
var compDef ComponentDefinition
compDef.Model = componentDefinition

return &compDef, nil

}

Expand Down
10 changes: 5 additions & 5 deletions src/pkg/common/oscal/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func TestMergeComponentDefinitions(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
component := oscal.ComponentDefinition{}
var component oscal.ComponentDefinition
err := component.NewModel(validBytes)
require.NoError(t, err)

Expand Down Expand Up @@ -519,7 +519,7 @@ func TestControlImplementationsToRequirementsMap(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
component := oscal.ComponentDefinition{}
var component oscal.ComponentDefinition

data := loadTestData(t, tt.filepath)
err := component.NewModel(data)
Expand Down Expand Up @@ -565,7 +565,7 @@ func TestFilterControlImplementations(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
component := oscal.ComponentDefinition{}
var component oscal.ComponentDefinition

data := loadTestData(t, tt.filepath)
err := component.NewModel(data)
Expand Down Expand Up @@ -593,7 +593,7 @@ func TestHandleExistingComponent(t *testing.T) {
require.NoError(t, err)

t.Run("Handle Existing with no existing data", func(t *testing.T) {
component := oscal.ComponentDefinition{}
var component oscal.ComponentDefinition
component.NewModel(validComponentBytes)

tmpDir := t.TempDir()
Expand All @@ -607,7 +607,7 @@ func TestHandleExistingComponent(t *testing.T) {
})

t.Run("Handle Existing with existing data", func(t *testing.T) {
component := oscal.ComponentDefinition{}
var component oscal.ComponentDefinition
component.NewModel(validComponentBytes)

err := component.HandleExisting(validGeneratedComponentPath)
Expand Down

0 comments on commit 296192f

Please sign in to comment.