Skip to content

Commit 44bc5d9

Browse files
strideynetgithub-actions
authored andcommitted
Use slices.DeleteFunc
1 parent 773c2b5 commit 44bc5d9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tool/teleport/common/teleport.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,13 +1015,10 @@ func onConfigDump(flags dumpFlags) error {
10151015
// Filter out the default directory /var/lib/teleport/bot used by `tbot` to
10161016
// avoid throwing a scary warning if `tbot` was installed prior to
10171017
// configuring teleport.
1018-
filteredEntries := make([]os.DirEntry, 0, len(entries))
1019-
for _, entry := range entries {
1020-
if entry.Name() != "bot" {
1021-
filteredEntries = append(filteredEntries, entry)
1022-
}
1023-
}
1024-
if err == nil && len(filteredEntries) != 0 {
1018+
entries = slices.DeleteFunc(entries, func(entry os.DirEntry) bool {
1019+
return entry.Name() == "bot"
1020+
})
1021+
if err == nil && len(entries) != 0 {
10251022
fmt.Fprintf(
10261023
os.Stderr,
10271024
"%s The data directory %s is not empty and may contain existing cluster state. Running this configuration is likely a mistake. To join a new cluster, specify an alternate --data-dir or clear the %s directory.\n",

0 commit comments

Comments
 (0)