Problem with append() with the Go SDK


currently, I fill my database with Couchbase’s Go SDK. But I have a problem with the append() function.

Bucket.Set(“a key”, 0, []byte(“test”))

reading back “a key” successfully prints []byte{“test”}.

But when I do an append() now:

Bucket.Append(“a key”, []byte(“TEST”))

and I use:

fill := []byte{}

Bucket.Get(“a key”, &fill)


it simply prints nothing, at all. And len(fill) prints 0.

Can you tell me what’s wrong? (When I look at the “a key” key in my browser (localhost:8091) it does print some data. How do I read it back?

Thank you

I think the problem is that bucket.Get treats the result as a JSON stream, which will not work since what you actually set is something like [“test”]Test, Get will return an error but your code seems to ignore that error so you get nothing printed. I created a gist with an example of append. Hope that helps.