This will not always work, you need to use ioutils.ReadAll, or check the return length of read.