From 46d3c4822b77b89ae319db67f3c2a9dafa12ba1c Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 3 Jan 2024 21:11:23 -0500 Subject: [PATCH] Lint fixes --- pkg/diff/namespace/diff.go | 23 +++++++++++++---------- pkg/tuple/onrset.go | 3 ++- pkg/tuple/onrset_test.go | 3 ++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pkg/diff/namespace/diff.go b/pkg/diff/namespace/diff.go index ea3a085163..c2f6e82fbd 100644 --- a/pkg/diff/namespace/diff.go +++ b/pkg/diff/namespace/diff.go @@ -172,7 +172,7 @@ func DiffNamespaces(existing *core.NamespaceDefinition, updated *core.NamespaceD } } - existingRelNames.Subtract(updatedRelNames).ForEach(func(removed string) error { + _ = existingRelNames.Subtract(updatedRelNames).ForEach(func(removed string) error { deltas = append(deltas, Delta{ Type: RemovedRelation, RelationName: removed, @@ -180,7 +180,7 @@ func DiffNamespaces(existing *core.NamespaceDefinition, updated *core.NamespaceD return nil }) - updatedRelNames.Subtract(existingRelNames).ForEach(func(added string) error { + _ = updatedRelNames.Subtract(existingRelNames).ForEach(func(added string) error { deltas = append(deltas, Delta{ Type: AddedRelation, RelationName: added, @@ -188,7 +188,7 @@ func DiffNamespaces(existing *core.NamespaceDefinition, updated *core.NamespaceD return nil }) - existingPermNames.Subtract(updatedPermNames).ForEach(func(removed string) error { + _ = existingPermNames.Subtract(updatedPermNames).ForEach(func(removed string) error { deltas = append(deltas, Delta{ Type: RemovedPermission, RelationName: removed, @@ -196,7 +196,7 @@ func DiffNamespaces(existing *core.NamespaceDefinition, updated *core.NamespaceD return nil }) - updatedPermNames.Subtract(existingPermNames).ForEach(func(added string) error { + _ = updatedPermNames.Subtract(existingPermNames).ForEach(func(added string) error { deltas = append(deltas, Delta{ Type: AddedPermission, RelationName: added, @@ -204,7 +204,7 @@ func DiffNamespaces(existing *core.NamespaceDefinition, updated *core.NamespaceD return nil }) - existingPermNames.Intersect(updatedPermNames).ForEach(func(shared string) error { + _ = existingPermNames.Intersect(updatedPermNames).ForEach(func(shared string) error { existingPerm := existingPerms[shared] updatedPerm := updatedPerms[shared] @@ -228,7 +228,7 @@ func DiffNamespaces(existing *core.NamespaceDefinition, updated *core.NamespaceD return nil }) - existingRelNames.Intersect(updatedRelNames).ForEach(func(shared string) error { + _ = existingRelNames.Intersect(updatedRelNames).ForEach(func(shared string) error { existingRel := existingRels[shared] updatedRel := updatedRels[shared] @@ -277,21 +277,24 @@ func DiffNamespaces(existing *core.NamespaceDefinition, updated *core.NamespaceD updatedAllowedRels.Add(source) } - for _, removed := range existingAllowedRels.Subtract(updatedAllowedRels).AsSlice() { + _ = existingAllowedRels.Subtract(updatedAllowedRels).ForEach(func(removed string) error { deltas = append(deltas, Delta{ Type: RelationAllowedTypeRemoved, RelationName: shared, AllowedType: allowedRelsBySource[removed], }) - } + return nil + }) - for _, added := range updatedAllowedRels.Subtract(existingAllowedRels).AsSlice() { + _ = updatedAllowedRels.Subtract(existingAllowedRels).ForEach(func(added string) error { deltas = append(deltas, Delta{ Type: RelationAllowedTypeAdded, RelationName: shared, AllowedType: allowedRelsBySource[added], }) - } + return nil + }) + return nil }) diff --git a/pkg/tuple/onrset.go b/pkg/tuple/onrset.go index 38753f658f..0496d1103d 100644 --- a/pkg/tuple/onrset.go +++ b/pkg/tuple/onrset.go @@ -3,8 +3,9 @@ package tuple import ( "maps" - core "github.com/authzed/spicedb/pkg/proto/core/v1" expmaps "golang.org/x/exp/maps" + + core "github.com/authzed/spicedb/pkg/proto/core/v1" ) // ONRSet is a set of ObjectAndRelation's. diff --git a/pkg/tuple/onrset_test.go b/pkg/tuple/onrset_test.go index c2cc33236a..43417d7e63 100644 --- a/pkg/tuple/onrset_test.go +++ b/pkg/tuple/onrset_test.go @@ -3,8 +3,9 @@ package tuple import ( "testing" - core "github.com/authzed/spicedb/pkg/proto/core/v1" "github.com/stretchr/testify/require" + + core "github.com/authzed/spicedb/pkg/proto/core/v1" ) func TestONRSet(t *testing.T) {