Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
initial cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Weiss committed Jan 14, 2019
1 parent 3fb2c16 commit ac399ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cli/cmd/convert/opencontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var includeXML bool
// }

// if includeXML {
// rawXMLOCOSCAL, err := ocOSCAL.RawXML(true)
// rawXMLOCOSCAL, err := ocOSCAL.XML(true)
// if err != nil {
// return cli.NewExitError(fmt.Sprintf("Error producing raw XML: %s", err), 1)
// }
Expand All @@ -58,7 +58,7 @@ var includeXML bool
// }

// if yaml {
// rawYAMLOCOSCAL, err := ocOSCAL.RawYAML()
// rawYAMLOCOSCAL, err := ocOSCAL.YAML()
// if err != nil {
// return cli.NewExitError(err, 1)
// }
Expand All @@ -67,7 +67,7 @@ var includeXML bool
// }
// }

// rawOCOSCAL, err := ocOSCAL.RawJSON(true)
// rawOCOSCAL, err := ocOSCAL.JSON(true)
// if err != nil {
// return cli.NewExitError(err, 1)
// }
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/convert/oscal.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func convert(src io.Reader, dest io.Writer, outputFormat string) error {
return err
}

oscalJSON, err := oscal.RawJSON(true)
oscalJSON, err := oscal.JSON(true)
if err != nil {
return err
}
Expand All @@ -197,7 +197,7 @@ func convert(src io.Reader, dest io.Writer, outputFormat string) error {
return err
}

oscalXML, err := oscal.RawXML(true)
oscalXML, err := oscal.XML(true)
if err != nil {
return err
}
Expand All @@ -218,7 +218,7 @@ func convert(src io.Reader, dest io.Writer, outputFormat string) error {
return err
}

oscalYAML, err := oscal.RawYAML()
oscalYAML, err := oscal.YAML()
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions types/oscal/oscal.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,23 @@ func New(r io.Reader) (*OSCAL, error) {
return nil, errors.New("Malformed OSCAL. Must be XML or JSON")
}

// RawXML ...
func (o *OSCAL) RawXML(prettify bool) ([]byte, error) {
// XML returns a byte slice containing the raw XML from the OSCAL object
func (o *OSCAL) XML(prettify bool) ([]byte, error) {
if prettify {
return xml.MarshalIndent(o, "", " ")
}
return xml.Marshal(o)
}

// RawJSON ...
func (o *OSCAL) RawJSON(prettify bool) ([]byte, error) {
// JSON returns a byte slice containing the raw JSON from the OSCAL object
func (o *OSCAL) JSON(prettify bool) ([]byte, error) {
if prettify {
return json.MarshalIndent(o, "", " ")
}
return json.Marshal(o)
}

// RawYAML ...
func (o *OSCAL) RawYAML() ([]byte, error) {
// YAML returns a byte slice containing the raw YAML from the OSCAL object
func (o *OSCAL) YAML() ([]byte, error) {
return yaml.Marshal(o)
}

0 comments on commit ac399ca

Please sign in to comment.