Skip to content

Commit

Permalink
Update 12.3.md (unknwon#501)
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
stevefoxuser authored and unknwon committed Jun 6, 2018
1 parent 4a8399e commit 6e8dcff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eBook/12.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6e8dcff

Please sign in to comment.