mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-18 07:08:42 +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>
41 lines
810 B
Go
41 lines
810 B
Go
package json
|
|
|
|
import (
|
|
"bytes"
|
|
)
|
|
|
|
// Object represents the encoding of a JSON Object type
|
|
type Object struct {
|
|
w *bytes.Buffer
|
|
writeComma bool
|
|
scratch *[]byte
|
|
}
|
|
|
|
func newObject(w *bytes.Buffer, scratch *[]byte) *Object {
|
|
w.WriteRune(leftBrace)
|
|
return &Object{w: w, scratch: scratch}
|
|
}
|
|
|
|
func (o *Object) writeKey(key string) {
|
|
escapeStringBytes(o.w, []byte(key))
|
|
o.w.WriteRune(colon)
|
|
}
|
|
|
|
// Key adds the given named key to the JSON object.
|
|
// Returns a Value encoder that should be used to encode
|
|
// a JSON value type.
|
|
func (o *Object) Key(name string) Value {
|
|
if o.writeComma {
|
|
o.w.WriteRune(comma)
|
|
} else {
|
|
o.writeComma = true
|
|
}
|
|
o.writeKey(name)
|
|
return newValue(o.w, o.scratch)
|
|
}
|
|
|
|
// Close encodes the end of the JSON Object
|
|
func (o *Object) Close() {
|
|
o.w.WriteRune(rightBrace)
|
|
}
|