Skip to content

Commit

Permalink
docs: updates README.md usage snippet
Browse files Browse the repository at this point in the history
Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 committed Mar 4, 2025
1 parent 170513d commit 6c2a785
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ go get github.com/oscal-compass/oscal-sdk-go

```go
import (
...
...
oscalTypes "github.com/defenseunicorns/go-oscal/src/types/oscal-1-1-2"
"github.com/oscal-compass/oscal-sdk-go/validation"

"github.com/oscal-compass/oscal-sdk-go/generators"
"github.com/oscal-compass/oscal-sdk-go/models"
"github.com/oscal-compass/oscal-sdk-go/transformers"
)

func main() {
file, err := os.Open("path-to-my-compdef")
file, err := os.Open("example-component-definition.json")
if err != nil {
log.Fatalf("failed to open component definition, %v", err)
}
definition, err := generators.NewComponentDefinition(file)
definition, err := models.NewComponentDefinition(file, validation.NoopValidator{})
if err != nil {
log.Fatalf("failed to read component definition, %v", err)
}
Expand All @@ -66,7 +67,7 @@ func main() {
if err != nil {
log.Fatalf("failed to marshal assessment plan, %v", err)
}
fmt.Println(assessmentPlanJSON)
fmt.Println(string(assessmentPlanJSON))
}
}
```
Expand Down

0 comments on commit 6c2a785

Please sign in to comment.