mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-14 09:37:50 +02:00
core/go: use hashicorp/go-set (#5278)
This commit is contained in:
parent
5679589014
commit
410354bc00
12 changed files with 66 additions and 176 deletions
|
@ -4,10 +4,10 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/go-set/v3"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/durationpb"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/sets"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/registry"
|
||||
)
|
||||
|
||||
|
@ -37,10 +37,10 @@ func (backend registryServer) List(
|
|||
}
|
||||
|
||||
res := new(registry.ServiceList)
|
||||
s := sets.NewHash[registry.ServiceKind]()
|
||||
s.Add(req.GetKinds()...)
|
||||
s := set.New[registry.ServiceKind](len(all))
|
||||
s.InsertSlice(req.GetKinds())
|
||||
for _, svc := range all {
|
||||
if s.Size() == 0 || s.Has(svc.GetKind()) {
|
||||
if s.Size() == 0 || s.Contains(svc.GetKind()) {
|
||||
res.Services = append(res.Services, svc)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue