// LimitWriter is a copy of the standard library ioutils.LimitReader, // applied to the writer interface. // LimitWriter returns a Writer that writes to w // but stops with EOF after n bytes. // The underlying implementation is a *LimitedWriter. func LimitWriter(w io.Writer, n int64) io.Writer { … } type LimitedWriter … func (l *LimitedWriter) Write(p []byte) (n int, err error) { … }