From 0425b993e84497e0bb3a8024d25ceca95aa84610 Mon Sep 17 00:00:00 2001 From: Wei Shen Date: Fri, 27 Jul 2018 21:54:11 +0800 Subject: [PATCH] fix bug of forgetting to close files... --- unikmer/cmd/diff.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unikmer/cmd/diff.go b/unikmer/cmd/diff.go index e9736ea..6606d6b 100644 --- a/unikmer/cmd/diff.go +++ b/unikmer/cmd/diff.go @@ -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) @@ -135,6 +134,8 @@ var diffCmd = &cobra.Command{ m[kcode.Code] = false } + infh.Close() + if opt.Verbose { log.Infof("%d Kmers loaded", len(m)) } @@ -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) @@ -253,6 +253,8 @@ var diffCmd = &cobra.Command{ } } + infh.Close() + // remove seen kmers for code, mark = range m1 { if mark {