You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/vendor/github.com/go-chef/chef/reader.go

16 lines
308 B

package chef
import (
"bytes"
"encoding/json"
"io"
)
// JSONReader handles arbitrary types and synthesizes a streaming encoder for them.
func JSONReader(v interface{}) (r io.Reader, err error) {
buf := new(bytes.Buffer)
err = json.NewEncoder(buf).Encode(v)
r = bytes.NewReader(buf.Bytes())
return
}