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"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -194,14 +194,8 @@ func main() {
|
||||||
regenImporter = true
|
regenImporter = true
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
// Don't write any files
|
||||||
|
sync.SetWriteFileFunc(func(dest string) (io.WriteCloser, error) { return &nullFileWriter{}, nil })
|
||||||
// Create temporary directory for storing FILES/ content
|
|
||||||
fic.FilesDir, err = ioutil.TempDir("", "fic-repochecker.")
|
|
||||||
if err != nil {
|
|
||||||
|
|
||||||
}
|
|
||||||
defer os.RemoveAll(fic.FilesDir)
|
|
||||||
|
|
||||||
if sync.GlobalImporter != nil {
|
if sync.GlobalImporter != nil {
|
||||||
log.Println("Using", sync.GlobalImporter.Kind())
|
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