The signature of the Writer.Write() method:
Write(p []byte) (n int, err error)
It records the contents of the fragment. Quoting from spec: Types of slices :
A slice is a descriptor for an adjacent segment of a base array ...
As we all know, a slice has a base array. Quoting again from Spec: Array Types :
Length is part of an array; it must evaluate the non-negative constant represented by an int value.
Thus, the maximum length of the array is limited by the maximum value of the int type (which is 2147483647 in the case of 32 bits and 9223372036854775807 in the case of 64-bit architectures).
So, back to the Writer.Write() method: since it writes the contents of the transmitted slice, it is guaranteed that the number of bytes written will be no more than what fits in the int .
Now the WriteTo.WriteTo() method:
WriteTo(w Writer) (n int64, err error)
Breaking or array is not mentioned anywhere. You have no guarantee that the result will match int , so int64 more than justified.
Example: BigBuffer
Imagine a BigBuffer implementation that temporarily writes data to an array or slice. An implementation can manage multiple arrays, so if one is full (for example, max int is reached), it continues in the other. Now, if this BigBuffer implements the WriteTo interface, and you call this method to write the contents to os.File , the result will be greater than max int .