MCPcopy Create free account
hub / github.com/google/gapid / getSlicePtr

Function getSlicePtr

core/data/slice/slice.go:154–164  ·  view source on GitHub ↗

getSlicePtr checks s is a pointer to a slice, returning both the pointer and slice as a reflect.Value.

(s interface{})

Source from the content-addressed store, hash-verified

152// getSlicePtr checks s is a pointer to a slice, returning both the pointer
153// and slice as a reflect.Value.
154func getSlicePtr(s interface{}) (ptr, slice reflect.Value) {
155 ptr = reflect.ValueOf(s)
156 if ptr.Kind() != reflect.Ptr {
157 panic(fmt.Errorf("s must be a pointer to a slice, got: %T", s))
158 }
159 slice = ptr.Elem()
160 if slice.Kind() != reflect.Slice {
161 panic(fmt.Errorf("s must be a pointer to a slice, got: %T", s))
162 }
163 return ptr, slice
164}
165
166// getSlice checks s is a slice, returning the slice as a reflect.Value.
167func getSlice(s interface{}) (slice reflect.Value) {

Callers 4

ReplaceFunction · 0.85
RemoveFunction · 0.85
RemoveAtFunction · 0.85
AppendFunction · 0.85

Calls 1

KindMethod · 0.65

Tested by

no test coverage detected