repochecker/*-inspector: Refactor file opening
This commit is contained in:
parent
257c594dbe
commit
14f10c91db
4 changed files with 31 additions and 31 deletions
|
|
@ -7,20 +7,19 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"srs.epita.fr/fic-server/admin/sync"
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
)
|
||||
|
||||
func checkTarball(path string, file *fic.EFile, exceptions *sync.CheckExceptions) (errs []error) {
|
||||
fd, err := os.Open(path)
|
||||
func checkTarball(file *fic.EFile, exceptions *sync.CheckExceptions) (errs []error) {
|
||||
fd, closer, err := sync.GetFile(sync.GlobalImporter, file.GetOrigin())
|
||||
if err != nil {
|
||||
log.Printf("Unable to open %q: %s", path, err.Error())
|
||||
log.Printf("Unable to open %q: %s", file.GetOrigin(), err.Error())
|
||||
return
|
||||
}
|
||||
defer fd.Close()
|
||||
defer closer()
|
||||
|
||||
var rd io.Reader
|
||||
if strings.HasSuffix(file.Name, ".tar.gz") {
|
||||
|
|
|
|||
Reference in a new issue