chore: remove redunant nil check (#408)

This commit is contained in:
Banana-J 2024-01-29 11:31:28 +11:00 committed by GitHub
parent 326a8c8984
commit 976dd799ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -58,7 +58,7 @@ func NewBatchDatabaseWithEncode(datadir string, cacheLimit int) *BatchDatabase {
}
func (db *BatchDatabase) IsEmptyKey(key []byte) bool {
return key == nil || len(key) == 0 || bytes.Equal(key, db.emptyKey)
return len(key) == 0 || bytes.Equal(key, db.emptyKey)
}
func (db *BatchDatabase) getCacheKey(key []byte) string {

View file

@ -78,7 +78,7 @@ func NewMongoDatabase(session *mgo.Session, dbName string, mongoURL string, repl
}
func (db *MongoDatabase) IsEmptyKey(key []byte) bool {
return key == nil || len(key) == 0 || bytes.Equal(key, db.emptyKey)
return len(key) == 0 || bytes.Equal(key, db.emptyKey)
}
func (db *MongoDatabase) getCacheKey(key []byte) string {