mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-11 11:48:33 +00:00
Some checks failed
Post / coverage (push) Failing after 26m56s
Post / images (amd64) (push) Failing after 6m52s
Post / images (arm64) (push) Failing after 6m50s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 54s
Scorecard supply-chain security / Scorecard analysis (push) Failing after 1m19s
* Acceping AWS IRSA registraion request Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Addressing comments Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Addressing comments Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Making csr as a default enabled driver if no other driver is explicitly enabled Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> --------- Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> Co-authored-by: “Jeffrey <jeffreywong0417@gmail.com> Co-authored-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com>
31 lines
594 B
Go
31 lines
594 B
Go
package json
|
|
|
|
import (
|
|
"bytes"
|
|
)
|
|
|
|
// Encoder is JSON encoder that supports construction of JSON values
|
|
// using methods.
|
|
type Encoder struct {
|
|
w *bytes.Buffer
|
|
Value
|
|
}
|
|
|
|
// NewEncoder returns a new JSON encoder
|
|
func NewEncoder() *Encoder {
|
|
writer := bytes.NewBuffer(nil)
|
|
scratch := make([]byte, 64)
|
|
|
|
return &Encoder{w: writer, Value: newValue(writer, &scratch)}
|
|
}
|
|
|
|
// String returns the String output of the JSON encoder
|
|
func (e Encoder) String() string {
|
|
return e.w.String()
|
|
}
|
|
|
|
// Bytes returns the []byte slice of the JSON encoder
|
|
func (e Encoder) Bytes() []byte {
|
|
return e.w.Bytes()
|
|
}
|