From 738fb74a1a59bce86d0e697ef2608026531db136 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 5 Nov 2024 16:30:46 +0100 Subject: [PATCH] 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 --- libnetwork/datastore/mockstore_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libnetwork/datastore/mockstore_test.go b/libnetwork/datastore/mockstore_test.go index 6532db6a10..db57e8e778 100644 --- a/libnetwork/datastore/mockstore_test.go +++ b/libnetwork/datastore/mockstore_test.go @@ -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