Source File
writer.go
Belonging Package
testing/iotest
// Copyright 2009 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package iotestimport// TruncateWriter returns a Writer that writes to w// but stops silently after n bytes.func ( io.Writer, int64) io.Writer {return &truncateWriter{, }}type truncateWriter struct {w io.Writern int64}func ( *truncateWriter) ( []byte) ( int, error) {if .n <= 0 {return len(), nil}// real write= len()if int64() > .n {= int(.n)}, = .w.Write([0:]).n -= int64()if == nil {= len()}return}
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)