August 2019
Beginner to intermediate
798 pages
17h 2m
English
A byte slice is a slice where its type is byte. You can create a new byte slice named s as follows:
s := make([]byte, 5)
Go knows that most slices of bytes are used to store strings and so makes it easy to switch between this type and the string type. There is nothing special in the way you can access a byte slice compared to the other types of slices. It is just that byte slices are used in file input and output operations. You will see byte slices in action in Chapter 8, Telling a UNIX System What to Do.
Read now
Unlock full access