repochecker: Use SetWriteFileFunc to avoid writing any file on disk
This commit is contained in:
parent
8723f500cc
commit
c2996b9f0a
2 changed files with 14 additions and 9 deletions
|
@ -6,7 +6,7 @@ import (
|
|||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -194,14 +194,8 @@ func main() {
|
|||
regenImporter = true
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
// Create temporary directory for storing FILES/ content
|
||||
fic.FilesDir, err = ioutil.TempDir("", "fic-repochecker.")
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
defer os.RemoveAll(fic.FilesDir)
|
||||
// Don't write any files
|
||||
sync.SetWriteFileFunc(func(dest string) (io.WriteCloser, error) { return &nullFileWriter{}, nil })
|
||||
|
||||
if sync.GlobalImporter != nil {
|
||||
log.Println("Using", sync.GlobalImporter.Kind())
|
||||
|
|
11
repochecker/null.go
Normal file
11
repochecker/null.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package main
|
||||
|
||||
type nullFileWriter struct{}
|
||||
|
||||
func (fw *nullFileWriter) Write(p []byte) (int, error) {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (fw *nullFileWriter) Close() error {
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue