diff --git a/commonspace/object/acl/list/list.go b/commonspace/object/acl/list/list.go index b77602af..81ecd499 100644 --- a/commonspace/object/acl/list/list.go +++ b/commonspace/object/acl/list/list.go @@ -222,7 +222,7 @@ func (a *aclList) AddRawRecord(rawRec *consensusproto.RawRecordWithId) (err erro RawRecord: rawRec.Payload, PrevId: record.PrevId, Id: record.Id, - Order: len(a.records) + 1, + Order: len(a.records), ChangeSize: len(rawRec.Payload), } return a.storage.AddAll(context.Background(), []StorageRecord{storageRec}) diff --git a/commonspace/object/acl/list/storage.go b/commonspace/object/acl/list/storage.go index 07442917..4c96d24c 100644 --- a/commonspace/object/acl/list/storage.go +++ b/commonspace/object/acl/list/storage.go @@ -217,7 +217,7 @@ func (s *storage) AddAll(ctx context.Context, records []StorageRecord) error { err = s.headStorage.UpdateEntryTx(tx.Context(), update) if err != nil { tx.Rollback() - return nil + return err } return tx.Commit() } diff --git a/commonspace/spaceservice.go b/commonspace/spaceservice.go index efcaf411..acaeba34 100644 --- a/commonspace/spaceservice.go +++ b/commonspace/spaceservice.go @@ -107,7 +107,7 @@ func (s *spaceService) CreateSpace(ctx context.Context, payload SpaceCreatePaylo } store, err := s.createSpaceStorage(ctx, storageCreate) if err != nil { - if err == spacestorage.ErrSpaceStorageExists { + if errors.Is(err, spacestorage.ErrSpaceStorageExists) { return storageCreate.SpaceHeaderWithId.Id, nil } return @@ -132,7 +132,7 @@ func (s *spaceService) DeriveSpace(ctx context.Context, payload SpaceDerivePaylo } store, err := s.createSpaceStorage(ctx, storageCreate) if err != nil { - if err == spacestorage.ErrSpaceStorageExists { + if errors.Is(err, spacestorage.ErrSpaceStorageExists) { return storageCreate.SpaceHeaderWithId.Id, nil } return @@ -144,7 +144,7 @@ func (s *spaceService) DeriveSpace(ctx context.Context, payload SpaceDerivePaylo func (s *spaceService) NewSpace(ctx context.Context, id string, deps Deps) (Space, error) { st, err := s.storageProvider.WaitSpaceStorage(ctx, id) if err != nil { - if err != spacestorage.ErrSpaceStorageMissing { + if !errors.Is(err, spacestorage.ErrSpaceStorageMissing) { return nil, err } @@ -214,7 +214,7 @@ func (s *spaceService) addSpaceStorage(ctx context.Context, spaceDescription Spa st, err = s.createSpaceStorage(ctx, payload) if err != nil { err = spacesyncproto.ErrUnexpected - if err == spacestorage.ErrSpaceStorageExists { + if errors.Is(err, spacestorage.ErrSpaceStorageExists) { err = spacesyncproto.ErrSpaceExists } return diff --git a/nodeconf/service.go b/nodeconf/service.go index 6a857c78..418ef395 100644 --- a/nodeconf/service.go +++ b/nodeconf/service.go @@ -115,7 +115,7 @@ func (s *service) Init(a *app.App) (err error) { s.source = a.MustComponent(CNameSource).(Source) s.store = a.MustComponent(CNameStore).(Store) lastStored, err := s.store.GetLast(context.Background(), s.config.NetworkId) - if err == ErrConfigurationNotFound { + if errors.Is(err, ErrConfigurationNotFound) { lastStored = s.config err = nil } else { @@ -139,7 +139,7 @@ func (s *service) Init(a *app.App) (err error) { s.sync = periodicsync.NewPeriodicSync(updatePeriodSec, 0, func(ctx context.Context) (err error) { err = s.updateConfiguration(ctx) if err != nil { - if err == ErrConfigurationNotChanged || err == ErrConfigurationNotFound { + if errors.Is(err, ErrConfigurationNotChanged) || errors.Is(err, ErrConfigurationNotFound) { err = nil } }