|
|
|
|
|
by jchw
2757 days ago
|
|
Easy: default zero is simple. It's predictable behavior. It's consistent. By convention, you should design your code to also treat zero values as empty. In Go, the zero value of bytes.Buffer is a ready to use, empty buffer. If you drop default zero, you lose a lot of convenience and gain a lot of ceremony. It's not the end of the world, but neither is the null pointer error. It's just another runtime error. Just like divide by zero. |
|