following: replace hashset with slice to keep order

This commit is contained in:
gutmet 2020-10-23 20:05:55 +02:00
parent 268bc13b79
commit 50339f7a18

View File

@ -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