following: replace hashset with slice to keep order
This commit is contained in:
parent
268bc13b79
commit
50339f7a18
|
@ -419,9 +419,8 @@ func like(args []string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _following() (following hashset) {
|
func _following() (following []string) {
|
||||||
log := func(err error) { optLogFatal("following", err) }
|
log := func(err error) { optLogFatal("following", err) }
|
||||||
following = makeHashset()
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
fmt.Fprintln(os.Stderr, r)
|
fmt.Fprintln(os.Stderr, r)
|
||||||
|
@ -435,7 +434,7 @@ func _following() (following hashset) {
|
||||||
err = json.Unmarshal(body, &response)
|
err = json.Unmarshal(body, &response)
|
||||||
log(err)
|
log(err)
|
||||||
for _, user := range response.Users {
|
for _, user := range response.Users {
|
||||||
following.add(user.Screen_name)
|
following = append(following, user.Screen_name)
|
||||||
}
|
}
|
||||||
cursor = response.Next_cursor
|
cursor = response.Next_cursor
|
||||||
}
|
}
|
||||||
|
@ -444,8 +443,8 @@ func _following() (following hashset) {
|
||||||
|
|
||||||
func following(args []string) error {
|
func following(args []string) error {
|
||||||
checkUsage(args, 0, 0, "following")
|
checkUsage(args, 0, 0, "following")
|
||||||
set := _following()
|
users := _following()
|
||||||
for user, _ := range set {
|
for _, user := range users {
|
||||||
fmt.Println(user)
|
fmt.Println(user)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user