Channels Internals

Learn about the hchan struct and some deep concepts in Golang.

The hchan struct

Internally, the channels implement an hchan struct, which holds the information related to the channels. It includes the buffer size buf, the sender sendx, the receiver recvx, the channel blocked due to sending sendq, the channel blocked due to receiving recvq, the mutex lock, and many more fields.

Get hands-on with 1200+ tech skills courses.