Getting Started with Go
If you haven’t set up a Riak Node and started it, please visit Running A Cluster first and ensure you have a working installation of Go.
Client Setup
First install the Riak Go client:
go get github.com/basho/riak-go-client Next download the Taste of Riak - Go utilities:
go get github.com/basho/taste-of-riak/go/util If you are using a single local Riak node, use the following to create a new client instance:
package main import ( "encoding/binary" "encoding/json" "sync" riak "github.com/basho/riak-go-client" util "github.com/basho/taste-of-riak/go/util" ) func main() { var err error // un-comment-out to enable debug logging // riak.EnableDebugLogging = true o := &riak.NewClientOptions{ RemoteAddresses: []string{util.GetRiakAddress()}, } var c *riak.Client c, err = riak.NewClient(o) if err != nil { util.ErrExit(err) } defer func() { if err := c.Stop(); err != nil { util.ErrExit(err) } }() } We are now ready to start interacting with Riak.
