Compile and Runtime Errors in Go Sample Programs

In working through the various go sample programs I am finding runtime and compile errors. I am running on MAC OSX; go version go1.6.2 darwin/amd64; connecting to a (vagrant) linux cluster.

  1. The starter program given at compiles but then generates a runtime error:

     $ couchbase
     User: {kingarthur [Holy Grail African Swallows]}
     panic: runtime error: invalid memory address or nil pointer dereference
     [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x255a]
     goroutine 1 [running]:
     panic(0x25a520, 0xc42000c0a0)
     	/usr/local/go/src/runtime/panic.go:500 +0x1a1
     	/Users/morrie/gotutorial/src/ +0x51a

Line 34 is execution of prepared N1QL query.

The following 2 problems involve programs in the devguide-examples-master/go set:

  1. sample program subdocument.go is failing to compile in my environment with the following error:

/subdocument.go:74: bucket.MutateIn(“goDevguideExampleSubdoc”, 0, 0).ArrayInsert(“fourthItem[2]”, “250 GTO Series II”).PushFront undefined (type *gocb.MutateInBuilder has no field or method PushFront)

  1. sample program query-create-index.go does compile and does run, but it is not clear what is supposed to to. It looks like it is reading the result of a primary index creation operation on the travel-sample bucket. I have the sense that an additional query was omitted.

I am a beginning Go programmer: it is quite possible I have made an elementary configuration mistake which is causing me to receive these errors.

Hey @morrie,

It looks like some of the examples haven’t been updated with some recent changes made to the SDK. I will get these updated for you as soon as possible.

Cheers, Brett