Closed graywolf-at-work closed 4 years ago
The error from os.Close is stored to err, which is the one created here https://github.com/oschwald/maxminddb-golang/blob/master/reader_other.go#L16 .
os.Close
err
That means that the assigment here https://github.com/oschwald/maxminddb-golang/blob/302864b2c4f7766813dede5095da8ba442c00c7e/reader_other.go#L22 basically does nothing.
Either this https://github.com/oschwald/maxminddb-golang/blob/master/reader_other.go#L15 should be
func Open(file string) (r *Reader, err error) {
but since that would mask actual error with one from os.Close, I think better option would be to just replace
defer func() { if rerr := mapFile.Close(); rerr != nil { err = rerr } }()
with
defer func() { mapFile.Close() }()
As written right now the code probably does not do what was intended.
Thanks! This was fixed in df020c7.
The error from
os.Close
is stored toerr
, which is the one created here https://github.com/oschwald/maxminddb-golang/blob/master/reader_other.go#L16 .That means that the assigment here https://github.com/oschwald/maxminddb-golang/blob/302864b2c4f7766813dede5095da8ba442c00c7e/reader_other.go#L22 basically does nothing.
Either this https://github.com/oschwald/maxminddb-golang/blob/master/reader_other.go#L15 should be
but since that would mask actual error with one from os.Close, I think better option would be to just replace
with
As written right now the code probably does not do what was intended.