Hacker News new | ask | show | jobs
by klodolph 1099 days ago
Copy operations in Go are normally destination first, source second. This includes builtins like copy() and library functions like io.Copy(). Making it "src, dest" would make this one case the opposite of all the others.

Note that the order mimics variable assignment. You copy an integer with:

    var src, dest int
    dest = src // dest first, src second
I appreciate the consistency.
1 comments

Thanks, "mimics variable assignment" is a good way to remember it