From e7ece5f51d0ae52052f63cb779252f890e1859ab Mon Sep 17 00:00:00 2001 From: Arvid Bjurklint Date: Sat, 3 Aug 2024 21:02:39 +0200 Subject: [PATCH] Rename entries to keys --- main.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 60aea5c..04252d0 100644 --- a/main.go +++ b/main.go @@ -28,16 +28,21 @@ func main() { IsDir: true, Name: "/", } + keys := getKeys(vault, entrypoint) + fmt.Println(keys) +} + +func getKeys(vault VaultClient, entrypoint DirEnt) []string { recv := make(chan string) go func() { recurse(recv, vault, entrypoint) close(recv) }() - entries := []string{} - for e := range recv { - entries = append(entries, e) + keys := []string{} + for key := range recv { + keys = append(keys, key) } - fmt.Println(entries) + return keys } type DirEnt struct { @@ -50,9 +55,9 @@ func recurse(recv chan string, vault VaultClient, entry DirEnt) { recv <- entry.Name return } - relative_entries := vault.listDir(entry.Name) + relativeEntries := vault.listDir(entry.Name) entries := []DirEnt{} - for _, sub := range relative_entries { + for _, sub := range relativeEntries { entries = append(entries, DirEnt{ IsDir: sub.IsDir, Name: entry.Name + sub.Name,