Use fmt.Errorf

This commit is contained in:
nemunaire 2020-04-15 07:39:38 +02:00
parent 45069d4fbb
commit adb424ea03
11 changed files with 50 additions and 60 deletions

View file

@ -4,7 +4,6 @@ import (
"bufio"
"bytes"
"encoding/base32"
"errors"
"fmt"
"io"
"os"
@ -75,7 +74,7 @@ func getFileSize(i Importer, URI string) (size int64, err error) {
}
}
return size, errors.New(fmt.Sprintf("%q: no such file or directory", URI))
return size, fmt.Errorf("%q: no such file or directory", URI)
}
// getFile helps to manage huge file transfert by concatenating splitted (with split(1)) files.
@ -110,7 +109,7 @@ func getFile(i Importer, URI string, writer *bufio.Writer) error {
}
}
return errors.New(fmt.Sprintf("%q: no such file or directory", URI))
return fmt.Errorf("%q: no such file or directory", URI)
}
// getFileContent retrieves the content of the given text file.