mirror of https://github.com/pkg/sftp.git
remove min function
This commit is contained in:
parent
0f6e8d5016
commit
1b6d816185
|
@ -1863,13 +1863,6 @@ func (f *File) Truncate(size int64) error {
|
|||
return f.c.setfstat(f.handle, sshFileXferAttrSize, uint64(size))
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a > b {
|
||||
return b
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
// normaliseError normalises an error into a more standard form that can be
|
||||
// checked against stdlib errors like io.EOF or os.ErrNotExist.
|
||||
func normaliseError(err error) error {
|
||||
|
|
|
@ -2313,7 +2313,12 @@ func benchmarkWrite(b *testing.B, bufsize int, delay time.Duration) {
|
|||
}
|
||||
|
||||
for offset < size {
|
||||
n, err := f2.Write(data[offset:min(len(data), offset+bufsize)])
|
||||
buf := data[offset:]
|
||||
if len(buf) > bufsize {
|
||||
buf = buf[:bufsize]
|
||||
}
|
||||
|
||||
n, err := f2.Write(buf)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue