It's not strictly speaking an error in this library, but you can add a check.
If you call geoip2.Open with a path that is a directory instead of a "normal" file,
the error "no such device" is returned.
I think you should check first the file's type.
Why did it occur in my case ?
Because my OS (Linux+Gnome), uncompresses the GeoLite2-Country.mmdb.gz when I double-click it, to a directory named GeoLite2-Country.mmdb which contains a file named data.
We are just returning the error from os.Open. Following its behavior seems like what most people would expect. I believe it would return an os.PathError in this case.
Hello,
It's not strictly speaking an error in this library, but you can add a check. If you call
geoip2.Open
with a path that is a directory instead of a "normal" file, the error "no such device" is returned. I think you should check first the file's type.Why did it occur in my case ? Because my OS (Linux+Gnome), uncompresses the
GeoLite2-Country.mmdb.gz
when I double-click it, to a directory namedGeoLite2-Country.mmdb
which contains a file nameddata
.