前言 在《深入理解 Go Slice》中,我们提到了 “根据其类型大小去获取能够申请的最大容量大小” 的处理逻辑。今天我们将更深入地去探究一下,底层到底做了什么东西,涉及什么知识点? Go Slice 对应代码如下: func makeslice(et *_type, len, cap int) slice { maxElements := maxSliceCap(et.size) if len < 0 || uintptr(len) > maxElements { ... } if cap < len || uintptr(cap) > maxElements { .