MCPcopy Create free account
hub / github.com/quay/clair / Example

Function Example

internal/codec/codec_test.go:15–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13)
14
15func Example() {
16 enc := GetEncoder(os.Stdout)
17 defer PutEncoder(enc)
18 enc.MustEncode([]string{"a", "slice", "of", "strings"})
19 fmt.Fprintln(os.Stdout)
20 enc.MustEncode(nil)
21 fmt.Fprintln(os.Stdout)
22 enc.MustEncode(map[string]string{})
23 fmt.Fprintln(os.Stdout)
24 // Output: ["a","slice","of","strings"]
25 // null
26 // {}
27}
28
29func BenchmarkDecode(b *testing.B) {
30 b.ReportAllocs()

Callers

nothing calls this directly

Calls 2

GetEncoderFunction · 0.85
PutEncoderFunction · 0.85

Tested by

no test coverage detected