Go-archive/tar: write after close gopher.txt

where?

  在使用Go中tar包循环写入内容的时候

why?

  因为已经关闭了tar.writer对象,所以无法写入,但是程序还是有写入操作,所以报错

way?

  通过 defer关键字来管理资源的释放,或者调整资源释放的位置

  

原文地址:https://www.cnblogs.com/2bjiujiu/p/9039142.html