mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
25 lines
467 B
Go
25 lines
467 B
Go
package util
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
func PrintJSON(data any) {
|
|
b, err := json.MarshalIndent(data, "", " ")
|
|
if err != nil {
|
|
log.Error().Err(err).Msgf("failed to marshal scanned results to JSON")
|
|
}
|
|
fmt.Println(string(b))
|
|
}
|
|
|
|
func PrintYAML(data any) {
|
|
b, err := yaml.Marshal(data)
|
|
if err != nil {
|
|
log.Error().Err(err).Msgf("failed to marshal scanned results to JSON")
|
|
}
|
|
fmt.Print(string(b))
|
|
}
|