pubby
2014-06-21 16:26:42 +08:00
升级到1.3 踩坑里去了
Reader.Read
54 ¦ // An instance of this general case is that a Reader returning
55 ¦ // a non-zero number of bytes at the end of the input stream may
56 ¦ // return either err == EOF or err == nil. The next Read should
57 ¦ // return 0, EOF regardless.
这里确实发生变化了:
1.2 的时候 最后一次Read 读到n byte, err == nil ,后续Read才会err == EOF
更新到1.3, 最后一次Read 读到n byte,并且err == EOF,不需要再次Read才会碰到EOF
之前没有严格按照文档做的恶果 ~~~55~~~,不少代码要改了
59 ¦ // Callers should always process the n > 0 bytes returned before
60 ¦ // considering the error err. Doing so correctly handles I/O errors
61 ¦ // that happen after reading some bytes and also both of the
62 ¦ // allowed EOF behaviors.