<h3 id="encoding_binary">The encoding/binary package</h3>
<p>
-In Go 1, the <code>binary.TotalSize</code></a> function is no longer exported.
+In Go 1, the <code>binary.TotalSize</code> function is renamed
+<a href="/pkg/encoding/binary/#Size"><code>Size</code></a>.
</p>
<p>
<h3 id="encoding_binary">The encoding/binary package</h3>
<p>
-In Go 1, the <code>binary.TotalSize</code></a> function is no longer exported.
+In Go 1, the <code>binary.TotalSize</code> function has been replaced by
+<a href="/pkg/encoding/binary/#Size"><code>Size</code></a>,
+which takes an <code>interface{}</code> argument rather than
+a <code>reflect.Value</code>.
</p>
<p>
return err
}
+// Size returns how many bytes Write would generate to encode the value v, assuming
+// the Write would succeed.
+func Size(v interface{}) int {
+ return dataSize(reflect.ValueOf(v))
+}
+
// dataSize returns the number of bytes the actual data represented by v occupies in memory.
// For compound structures, it sums the sizes of the elements. Thus, for instance, for a slice
// it returns the length of the slice times the element size and does not count the memory