Skip to content

Commit

Permalink
Fix build failures after title being converted to Markup
Browse files Browse the repository at this point in the history
  • Loading branch information
isimluk committed Oct 6, 2020
1 parent 9224558 commit 00ebfba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions cli/cmd/info.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"fmt"
"errors"
"fmt"

"github.com/gocomply/oscalkit/pkg/oscal/constants"
"github.com/gocomply/oscalkit/pkg/oscal_source"
Expand Down Expand Up @@ -84,7 +84,7 @@ func printMetadata(m *catalog.Metadata) {
return
}
fmt.Println("Metadata:")
fmt.Println("\tTitle:\t\t\t", m.Title)
fmt.Println("\tTitle:\t\t\t", m.Title.Raw)
if m.Published != "" {
fmt.Println("\tPublished:\t\t", m.Published)
}
Expand Down Expand Up @@ -112,8 +112,8 @@ func printImports(p *profile.Profile) error {
return fmt.Errorf("Could not resolve profile import %s", imp.Href)
}

if resource.Title != "" {
fmt.Println("\tTitle:\t\t\t", resource.Title)
if resource.Title != nil {
fmt.Println("\tTitle:\t\t\t", resource.Title.Raw)
}
if resource.Desc != "" {
fmt.Println("\tDesc:\t\t\t", resource.Desc)
Expand Down
4 changes: 2 additions & 2 deletions pkg/opencontrol/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewStandard(catalog *catalog.Catalog) (*Standard, error) {
}

return &Standard{
Name: string(catalog.Metadata.Title),
Name: string(catalog.Metadata.Title.Raw),
Controls: controls,
}, nil
}
Expand All @@ -56,7 +56,7 @@ func (std *Standard) SaveToFile(filename string) error {
func (controls Controls) Add(ctrl *catalog.Control, family string) {
controls[oscalIdToOpencontrol(ctrl.Id)] = Control{
Family: family,
Name: string(ctrl.Title),
Name: string(ctrl.Title.Raw),
Description: ctrl.StatementToMarkdown(),
}
for _, child := range ctrl.Controls {
Expand Down
4 changes: 2 additions & 2 deletions types/oscal/catalog/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type ControlOpts struct {
func NewPart(id, title, narrative string) Part {
return Part{
Id: id,
Title: Title(title),
Title: &Title{Raw: title},
Prose: &Prose{Raw: narrative},
}
}
Expand All @@ -20,7 +20,7 @@ func NewPart(id, title, narrative string) Part {
func NewControl(id, title string, opts *ControlOpts) Control {
ctrl := Control{
Id: id,
Title: Title(title),
Title: &Title{Raw: title},
}
if opts != nil {
ctrl.Controls = opts.Controls
Expand Down
6 changes: 3 additions & 3 deletions types/oscal/nominal_catalog/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
)

func (param *Param) TextRepresentation() string {
if param.Label != "" {
return fmt.Sprintf("[Assignment: %s]", param.Label)
if param.Label != nil {
return fmt.Sprintf("[Assignment: %s]", param.Label.Raw)

}
if param.Select != nil {
Expand All @@ -18,7 +18,7 @@ func (param *Param) TextRepresentation() string {

choicesList := make([]string, len(param.Select.Alternatives))
for i, v := range param.Select.Alternatives {
choicesList[i] = string(v)
choicesList[i] = string(v.Raw)
}
choices := strings.Join(choicesList, ", ")

Expand Down

0 comments on commit 00ebfba

Please sign in to comment.