Skip to content

Commit

Permalink
Rename entries to keys
Browse files Browse the repository at this point in the history
  • Loading branch information
slarwise committed Aug 3, 2024
1 parent 6b9cebb commit e7ece5f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit e7ece5f

Please sign in to comment.