Uploaded image for project: 'Couchbase Go SDK'
  1. Couchbase Go SDK
  2. GOCBC-108

Panic when trying to access a bucket that does not exsist.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.0.6
    • 1.0.5
    • library
    • None

    Description

      I would not expect a panic when accessing a bucket that does not exist:

      panic: runtime error: invalid memory address or nil pointer dereference
      [signal 0xb code=0x1 addr=0x20 pc=0x75dbc]
       
      goroutine 1 [running]:
      panic(0x3cbb20, 0xc82000a100)
              /usr/local/Cellar/go/1.6.1/libexec/src/runtime/panic.go:464 +0x3e6
      gopkg.in/couchbase/gocb%2ev1.(*Bucket).get.func1(0xc820010600, 0x0, 0x0, 0x0, 0x0)
              /Users/patrick/Code/Go/src/gopkg.in/couchbase/gocb.v1/bucket_crud.go:216 +0x8c
      gopkg.in/couchbase/gocb%2ev1.(*Bucket).hlpGetExec(0x0, 0x3089a0, 0xc82002e068, 0xc8200d1e40, 0x0, 0x0, 0x0)
              /Users/patrick/Code/Go/src/gopkg.in/couchbase/gocb.v1/bucket_crud.go:131 +0x16a
      gopkg.in/couchbase/gocb%2ev1.(*Bucket).get(0x0, 0x491fc0, 0x13, 0x3089a0, 0xc82002e068, 0x324180, 0x0, 0x0)
              /Users/patrick/Code/Go/src/gopkg.in/couchbase/gocb.v1/bucket_crud.go:218 +0x78
      gopkg.in/couchbase/gocb%2ev1.(*Bucket).Get(0x0, 0x491fc0, 0x13, 0x3089a0, 0xc82002e068, 0x0, 0x0, 0x0)
              /Users/patrick/Code/Go/src/gopkg.in/couchbase/gocb.v1/bucket_crud.go:11 +0x58
      main.main()
              /Users/patrick/Code/Go/cb-hello.go:13 +0xc4
      exit status 2
      

      Code:

      package main
       
      import (
      "gopkg.in/couchbase/gocb.v1";
      "fmt"
      )
       
      func main() {
          myCluster, _ := gocb.Connect("couchbase://127.0.0.1")
          myBucket, _ := myCluster.OpenBucket("nobucket", "")
       
          var beer map[string]interface{}
          cas, _ := myBucket.Get("aass_brewery-juleol", &beer)
          fmt.Println(cas)
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            brett19 Brett Lawson
            pvarley Patrick Varley (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty