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>
36 lines
657 B
Go
36 lines
657 B
Go
package json
|
|
|
|
import (
|
|
"bytes"
|
|
)
|
|
|
|
// Array represents the encoding of a JSON Array
|
|
type Array struct {
|
|
w *bytes.Buffer
|
|
writeComma bool
|
|
scratch *[]byte
|
|
}
|
|
|
|
func newArray(w *bytes.Buffer, scratch *[]byte) *Array {
|
|
w.WriteRune(leftBracket)
|
|
return &Array{w: w, scratch: scratch}
|
|
}
|
|
|
|
// Value adds a new element to the JSON Array.
|
|
// Returns a Value type that is used to encode
|
|
// the array element.
|
|
func (a *Array) Value() Value {
|
|
if a.writeComma {
|
|
a.w.WriteRune(comma)
|
|
} else {
|
|
a.writeComma = true
|
|
}
|
|
|
|
return newValue(a.w, a.scratch)
|
|
}
|
|
|
|
// Close encodes the end of the JSON Array
|
|
func (a *Array) Close() {
|
|
a.w.WriteRune(rightBracket)
|
|
}
|