Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
josephschorr committed Jan 4, 2024
1 parent 8d5831b commit 46d3c48
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
23 changes: 13 additions & 10 deletions pkg/diff/namespace/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,39 +172,39 @@ 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,
})
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,
})
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,
})
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,
})
return nil
})

existingPermNames.Intersect(updatedPermNames).ForEach(func(shared string) error {
_ = existingPermNames.Intersect(updatedPermNames).ForEach(func(shared string) error {
existingPerm := existingPerms[shared]
updatedPerm := updatedPerms[shared]

Expand All @@ -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]

Expand Down Expand Up @@ -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
})

Expand Down
3 changes: 2 additions & 1 deletion pkg/tuple/onrset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion pkg/tuple/onrset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 46d3c48

Please sign in to comment.