MCPcopy Create free account
hub / github.com/cloudbase/garm / asRawMessage

Function asRawMessage

cmd/garm-cli/cmd/pool.go:643–658  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

641}
642
643func asRawMessage(data []byte) (json.RawMessage, error) {
644 // unmarshaling and marshaling again will remove new lines and verify we
645 // have a valid json.
646 var unmarshaled interface{}
647 if err := json.Unmarshal(data, &unmarshaled); err != nil {
648 return nil, fmt.Errorf("error decoding extra specs: %w", err)
649 }
650
651 var asRawJSON json.RawMessage
652 var err error
653 asRawJSON, err = json.Marshal(unmarshaled)
654 if err != nil {
655 return nil, fmt.Errorf("error marshaling json: %w", err)
656 }
657 return asRawJSON, nil
658}
659
660func formatPools(pools []params.Pool) {
661 if outputFormat == common.OutputFormatJSON {

Callers 3

scalesets.goFile · 0.85
pool.goFile · 0.85
extraSpecsFromFileFunction · 0.85

Calls 1

MarshalMethod · 0.45

Tested by

no test coverage detected