From af985bf47919b8a710f22e93777504ec3ca23a1f Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Tue, 13 Feb 2024 00:25:58 +0330 Subject: [PATCH] rename func close to closeCloser --- dict.go | 2 +- dictionary.go | 2 +- ifo.go | 2 +- utils.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dict.go b/dict.go index e867d34..5051005 100644 --- a/dict.go +++ b/dict.go @@ -52,7 +52,7 @@ func (d *Dict) Close() { return } log.Println("Closing", d.filename) - close(d.file) + closeCloser(d.file) d.file = nil } diff --git a/dictionary.go b/dictionary.go index 4b82ed5..5492476 100644 --- a/dictionary.go +++ b/dictionary.go @@ -72,7 +72,7 @@ func (d *dictionaryImp) CalcHash() ([]byte, error) { if err != nil { return nil, err } - defer close(file) + defer closeCloser(file) hash := murmur3.New128() if _, err := io.Copy(hash, file); err != nil { return nil, err diff --git a/ifo.go b/ifo.go index f717136..b88d7a8 100644 --- a/ifo.go +++ b/ifo.go @@ -73,7 +73,7 @@ func ReadInfo(filename string) (info *Info, err error) { return } - defer close(reader) + defer closeCloser(reader) r := bufio.NewReader(reader) diff --git a/utils.go b/utils.go index f11e8a5..237e643 100644 --- a/utils.go +++ b/utils.go @@ -5,7 +5,7 @@ import ( "log" ) -func close(c io.Closer) { +func closeCloser(c io.Closer) { err := c.Close() if err != nil { log.Println(err)