From 6e8dcffdf7da314f7dd97949e4c070b9f154c348 Mon Sep 17 00:00:00 2001 From: stevefoxuser <358291923@qq.com> Date: Wed, 6 Jun 2018 10:11:39 +0800 Subject: [PATCH] Update 12.3.md (#501) Fixed a that if dstName file's length longer than srcName file io.Copy will cover only part content of srcName file. If file srcName 's content is "abc", dstName's content is "1234" ,the result of io.Copy(dst, src) is "abc4" not "abc" --- eBook/12.3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eBook/12.3.md b/eBook/12.3.md index 6fe979d..24008d3 100644 --- a/eBook/12.3.md +++ b/eBook/12.3.md @@ -26,7 +26,7 @@ func CopyFile(dstName, srcName string) (written int64, err error) { } defer src.Close() - dst, err := os.OpenFile(dstName, os.O_WRONLY|os.O_CREATE, 0644) + dst, err := os.Create(dstName) if err != nil { return }