After reading some articles, most people will say that sliceHeader is the essence of slice, so what is slice in slice.go?

so ?

“essence” is something abstract and metaphoric. What do you mean by it, are you interested on how slice objects look like at runtime ?

Yes, it’s not clear what sliceHeader does
my english is not very good, I used google translation

Have you read: Go Slices: usage and internals - go.dev (here’s a link translated into Chinese with Google translate).

There is no mention of sliceHeader related content here.

The “Slice internals” (Chinese) section describes how slices work. In the example, there are 3 fields: ptr, len, and cap. Those fields correspond to the slice struct’s array, len, and cap fields, respectively.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.