"Since the switch value is just true, we could leave it off—as is also the situation in a for statement, a missing value means true. In fact, such a switch is a form of if-else chain. While we're here, it should be mentioned that in switch statements each case has an implicit break."
The basic outcome is that:
1. The assignment to er, nr is an initialization statement for the switch.
2. The true (default value if not specified) is used to configure the switch as an if-else chain which is required as the assignment above makes the purpose of the switch ambiguous (is the result of the assignment configuring the switch - how do you do that as multiple values are returned?).
You could rewrite it:
nr, er := f.Read(buf[:]);
switch true {
...
}
or even:
nr, er := f.Read(buf[:]);
switch {
...
}
But the switch initializer scopes it to the switch block cleanly.