Remove Jiayong as Maintainer, update base images from arvados/jobs -> python:3.8...
[lightning.git] / anno2vcf.go
index 23c6f21ece59f6c6b8ad7997472248519db12464..582254099b464a0f42390877e51bb19aa9418e4a 100644 (file)
@@ -10,7 +10,6 @@ import (
        "flag"
        "fmt"
        "io"
-       "io/ioutil"
        "net/http"
        _ "net/http/pprof"
        "os"
@@ -48,6 +47,9 @@ func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
                return 0
        } else if err != nil {
                return 2
+       } else if flags.NArg() > 0 {
+               err = fmt.Errorf("errant command line arguments after parsed flags: %v", flags.Args())
+               return 2
        }
 
        if *pprof != "" {
@@ -118,10 +120,16 @@ func (cmd *anno2vcf) RunCommand(prog string, args []string, stdin io.Reader, std
                filename := *inputDir + "/" + fi.Name()
                thr.Go(func() error {
                        log.Printf("reading %s", filename)
-                       buf, err := ioutil.ReadFile(filename)
+                       f, err := open(filename)
+                       if err != nil {
+                               return err
+                       }
+                       defer f.Close()
+                       buf, err := io.ReadAll(f)
                        if err != nil {
                                return fmt.Errorf("%s: %s", filename, err)
                        }
+                       f.Close()
                        lines := bytes.Split(buf, []byte{'\n'})
                        calls := map[string][]*call{}
                        for lineIdx, line := range lines {