MCPcopy
hub / github.com/pquerna/ffjson / emptyInterface

Function emptyInterface

tests/ff_test.go:252–258  ·  view source on GitHub ↗

emptyInterface creates a new instance of the object sent It the returned interface is writable and contains the zero value.

(a interface{})

Source from the content-addressed store, hash-verified

250// emptyInterface creates a new instance of the object sent
251// It the returned interface is writable and contains the zero value.
252func emptyInterface(a interface{}) interface{} {
253 aval := reflect.ValueOf(a)
254 indirect := reflect.Indirect(aval)
255 newIndirect := reflect.New(indirect.Type())
256
257 return newIndirect.Interface()
258}
259func testType(t *testing.T, base interface{}, ff interface{}) {
260 require.Implements(t, (*json.Marshaler)(nil), ff)
261 require.Implements(t, (*json.Unmarshaler)(nil), ff)

Callers 1

testCycleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…