libnetwork/datastore: MockStore.AtomicPut: remove redundant nil check (govet)

libnetwork/datastore/mockstore_test.go:70:12: nilness: tautological condition: non-nil != nil (govet)
            if mData != nil && mData.Index != previous.LastIndex {
                     ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-11-05 16:30:46 +01:00
parent 473b1d419c
commit 738fb74a1a

View File

@@ -62,14 +62,16 @@ func (s *MockStore) AtomicPut(key string, newValue []byte, previous *store.KVPai
if previous == nil {
if mData != nil {
return nil, types.InvalidParameterErrorf("atomic put failed because key exists")
} // Else OK.
}
// Else OK.
} else {
if mData == nil {
return nil, types.InvalidParameterErrorf("atomic put failed because key exists")
}
if mData != nil && mData.Index != previous.LastIndex {
if mData.Index != previous.LastIndex {
return nil, types.InvalidParameterErrorf("atomic put failed due to mismatched Index")
} // Else OK.
}
// Else OK.
}
if err := s.Put(key, newValue); err != nil {
return nil, err