mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 04:54:18 +02:00
adopt latest golang enhancements (#91)
This commit is contained in:
@@ -20,6 +20,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"slices"
|
||||
|
||||
"codeberg.org/scip/esctl/pkg/cfg"
|
||||
"codeberg.org/scip/esctl/pkg/printer"
|
||||
@@ -33,15 +35,7 @@ func RoleNames(conf *cfg.Config) ([]string, error) {
|
||||
return nil, fmt.Errorf("failed to get roles: %w", esErrorString(err))
|
||||
}
|
||||
|
||||
roles := make([]string, len(res))
|
||||
|
||||
idx := 0
|
||||
for name := range res {
|
||||
roles[idx] = name
|
||||
idx++
|
||||
}
|
||||
|
||||
return roles, nil
|
||||
return slices.Collect(maps.Keys(res)), nil
|
||||
}
|
||||
|
||||
func RoleList(conf *cfg.Config) error {
|
||||
|
||||
Reference in New Issue
Block a user