-1

I am trying to import "github.com/couchbaselabs/go-couchbase", however the LiteIDE saids:

 cannot find package "github.com/couchbaselabs/go-couchbase" in any of:
 /usr/lib/go/src/pkg/github.com/couchbaselabs/go-couchbase (from $GOROOT)
 /home/peter/gosrc/src/test_program/src/github.com/couchbaselabs/go-couchbase(from GOPATH) 

Here is my code:

import (    
"encoding/json"
"fmt"
"github.com/couchbaselabs/go-couchbase"
)

So what is the possible reason? I have set the custom directory to /home/peter/gosrc/src/test_program.

  • 2
    Please start with the documentation: [How to Write Go Code](http://golang.org/doc/code.html) and [Effective Go](http://golang.org/doc/effective_go.html) are two good resources. – JimB Aug 06 '14 at 14:14

1 Answers1

1

You should first use the "go get" command to fetch the source of the files and install them into your GOPATH directory because go-couchbase is a remote package and it is not yet present in your system.

' go get github.com/couchbaselabs/go-couchbase '

This is an article on the official golang website which explains how to get remote packages http://golang.org/doc/code.html#remote.

You can also read more about the go commands such as "go get" or "go test" here.

Marc
  • 1,760
  • 14
  • 10