aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-19 01:35:17 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-19 01:35:17 +0200
commit936aec757ead25829b8f034def66dbf4adb7707b (patch)
tree7c0c5fd6d0c34829bf06052e3b2a3055cd0d9db7
parent024132dfb8617fbc255e0423319e8692a6867370 (diff)
downloadrefcat-936aec757ead25829b8f034def66dbf4adb7707b.tar.gz
refcat-936aec757ead25829b8f034def66dbf4adb7707b.zip
do not fail on partial input; extend logging
-rw-r--r--skate/cmd/skate-reduce/main.go9
-rw-r--r--skate/zippy.go8
2 files changed, 13 insertions, 4 deletions
diff --git a/skate/cmd/skate-reduce/main.go b/skate/cmd/skate-reduce/main.go
index 6c69121..eb84e38 100644
--- a/skate/cmd/skate-reduce/main.go
+++ b/skate/cmd/skate-reduce/main.go
@@ -55,6 +55,7 @@ var (
batchSize = flag.Int("b", 10000, "batch size")
mode = flag.String("m", "ref", "mode, e.g. exact, verify, ref, bref, wiki")
quite = flag.Bool("q", false, "be quite")
+ logFile = flag.String("log", "", "log filename")
// Possible inputs -- we could switch to a subcommand cli parser?
refs = flag.String("F", "", "path to refs input")
@@ -74,6 +75,14 @@ var (
func main() {
flag.Parse()
+ if *logFile != "" {
+ f, err := os.OpenFile(*logFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer f.Close()
+ log.SetOutput(f)
+ }
if *quite {
log.SetOutput(ioutil.Discard)
}
diff --git a/skate/zippy.go b/skate/zippy.go
index 237162f..db64ad1 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -40,13 +40,13 @@ func ZippyExact(releases, refs io.Reader, matchResult MatchResult, w io.Writer)
return nil
}
if target, err = stringToRelease(cut(g.G0[0], "\t", 2)); err != nil {
- groupLogf(g, "failed to parse release: %v", err)
- return err
+ groupLogf(g, "[skip] failed to parse release: %v", err)
+ continue
}
for _, line := range g.G1 {
if ref, err = stringToRef(cut(line, "\t", 2)); err != nil {
- groupLogf(g, "failed to parse ref: %v", err)
- return err
+ groupLogf(g, "[skip] failed to parse ref: %v", err)
+ continue
}
var bref BiblioRef
bref.SourceReleaseIdent = ref.ReleaseIdent