Cap returns the capacity of this value for arrays, channels and slices. For other types, it panics.
()
| 813 | // Cap returns the capacity of this value for arrays, channels and slices. |
| 814 | // For other types, it panics. |
| 815 | func (v Value) Cap() int { |
| 816 | switch v.typecode.Kind() { |
| 817 | case Array: |
| 818 | return v.typecode.Len() |
| 819 | case Chan: |
| 820 | return chancap(v.pointer()) |
| 821 | case Slice: |
| 822 | return int((*sliceHeader)(v.value).cap) |
| 823 | default: |
| 824 | panic(&ValueError{Method: "Cap", Kind: v.Kind()}) |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | //go:linkname mapclear runtime.hashmapClear |
| 829 | func mapclear(p unsafe.Pointer) |