From 50339f7a18cd127d91002a5342fc9edbdff8ad97 Mon Sep 17 00:00:00 2001 From: gutmet Date: Fri, 23 Oct 2020 20:05:55 +0200 Subject: [PATCH] following: replace hashset with slice to keep order --- drivel.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivel.go b/drivel.go index 8ece7a3..7a8ba45 100644 --- a/drivel.go +++ b/drivel.go @@ -419,9 +419,8 @@ func like(args []string) error { return nil } -func _following() (following hashset) { +func _following() (following []string) { log := func(err error) { optLogFatal("following", err) } - following = makeHashset() defer func() { if r := recover(); r != nil { fmt.Fprintln(os.Stderr, r) @@ -435,7 +434,7 @@ func _following() (following hashset) { err = json.Unmarshal(body, &response) log(err) for _, user := range response.Users { - following.add(user.Screen_name) + following = append(following, user.Screen_name) } cursor = response.Next_cursor } @@ -444,8 +443,8 @@ func _following() (following hashset) { func following(args []string) error { checkUsage(args, 0, 0, "following") - set := _following() - for user, _ := range set { + users := _following() + for _, user := range users { fmt.Println(user) } return nil