Skip to content

Commit

Permalink
fix bug of forgetting to close files...
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Jul 27, 2018
1 parent dcef0c9 commit 0425b99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions unikmer/cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ var diffCmd = &cobra.Command{

infh, err = xopen.Ropen(file)
checkError(err)
defer infh.Close()

reader, err = unikmer.NewReader(infh)
checkError(err)
Expand All @@ -135,6 +134,8 @@ var diffCmd = &cobra.Command{
m[kcode.Code] = false
}

infh.Close()

if opt.Verbose {
log.Infof("%d Kmers loaded", len(m))
}
Expand Down Expand Up @@ -229,7 +230,6 @@ var diffCmd = &cobra.Command{

infh, err = xopen.Ropen(file)
checkError(err)
defer infh.Close()

reader, err = unikmer.NewReader(infh)
checkError(err)
Expand All @@ -253,6 +253,8 @@ var diffCmd = &cobra.Command{
}
}

infh.Close()

// remove seen kmers
for code, mark = range m1 {
if mark {
Expand Down

0 comments on commit 0425b99

Please sign in to comment.