3 ms·
How is this, say, not idiomatic Go? fi, err := directory.Readdir(0) if err != nil { db = nil logg.Err("database", "Open", err.String()) return db, st.Ca
by dextorious 15y ago
How is this, say, not idiomatic Go?
fi, err := directory.Readdir(0)
if err != nil {
db = nil
logg.Err("database", "Open", err.String())
return db, st.CannotReadDatabaseDirectory
}
- BarkMore 15y agoThe package uses integer to represents errors instead of os.Error. This fragment of code is not idiomatic because st.CannotReadDatabaseDirectory is not an os.Error.
- dextorious 15y agoI see -I missed that part. I think even os.Error is not idiomatic anymore, they move Error outside the os package to a type of it's own in a later version.
- BarkMore 15y agoThe pre-declared type error replaces os.Error in the next release of Go.