如何在Go中将JSON对象“推送”到数组?

I'm just fetching json from a Redis db and trying to append it to an array.

In Javascript I would do something like this:

var myarray = [];

//blah blah contact Redis and get the response

myarray.push(redisresponse);

I'm having trouble figuring out how to do that in Go.

Library suggestions welcome!

Let's say you want to get a string response from Redis. Using the redigo library you can send a command and receive the response back using it's helper methods.

This is a snippet of how you can do that:

import "github.com/garyburd/redigo/redis"

someCap := 10 // Make the slice however large you need it.
myarray := make([]string, someCap)
redisConn, err := redis.Dial("tcp" "your_redis_host:port")
if err != nil {
    // Handle your error accordingly.
}
defer redisConn.Close()

resp, err := redis.String(redisConn.Do("GET", "some_key"))
if err != nil {
    // Handle your error accordingly.
}
myarray = append(myarray, resp)