优化
This commit is contained in:
@@ -71,7 +71,7 @@ func (s *APIService) Groups(ctx context.Context) ([]string, map[string]string, e
|
||||
return nil, nil, err
|
||||
}
|
||||
seen := make(map[string]bool)
|
||||
groups := make([]string, 0)
|
||||
var groups []string
|
||||
groupAPIMap := make(map[string]string)
|
||||
for _, item := range items {
|
||||
if !seen[item.APIGroup] {
|
||||
@@ -126,7 +126,10 @@ func (s *APIService) PolicyPathResponses(ctx context.Context, authorityID uint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out := make([]dto.PolicyPathRequest, 0, len(items))
|
||||
var out []dto.PolicyPathRequest
|
||||
if len(items) > 0 {
|
||||
out = make([]dto.PolicyPathRequest, 0, len(items))
|
||||
}
|
||||
for _, item := range items {
|
||||
out = append(out, dto.PolicyPathRequest{Path: item.Path, Method: item.Method})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user