build failing with go version 1.4.2
Compilation failing. $ go version go version go1.4.2 linux/amd64
$ go build ./drive.go drive.go:5:2: cannot find package "github.com/prasmussen/gdrive/cli" in any of: /usr/lib/go/src/github.com/prasmussen/gdrive/cli (from $GOROOT) ($GOPATH not set) drive.go:6:2: cannot find package "github.com/prasmussen/gdrive/gdrive" in any of: /usr/lib/go/src/github.com/prasmussen/gdrive/gdrive (from $GOROOT) ($GOPATH not set) drive.go:7:2: cannot find package "github.com/prasmussen/gdrive/util" in any of: /usr/lib/go/src/github.com/prasmussen/gdrive/util (from $GOROOT) ($GOPATH not set) drive.go:8:2: cannot find package "github.com/prasmussen/google-api-go-client/googleapi" in any of: /usr/lib/go/src/github.com/prasmussen/google-api-go-client/googleapi (from $GOROOT) ($GOPATH not set) drive.go:9:2: cannot find package "github.com/voxelbrain/goptions" in any of: /usr/lib/go/src/github.com/voxelbrain/goptions (from $GOROOT) ($GOPATH not set)
I have go version 1.4.2
The error shows that gopath is not set , set it by using
export GOPATH=/path/to/gdrive/folder
And then run the build command
Issue still occuring after setting GOPATH.
$ export GOPATH=pwd
$ echo $GOPATH
/home/joev/Downloads/gdrive
$ ls
auth build-all.sh cli config drive.go gdrive LICENSE README.md upload.sh util
$ go build drive.go
drive.go:5:2: cannot find package "github.com/prasmussen/gdrive/cli" in any of:
/usr/lib/go/src/github.com/prasmussen/gdrive/cli (from $GOROOT)
/home/joev/Downloads/gdrive/src/github.com/prasmussen/gdrive/cli (from $GOPATH)
drive.go:6:2: cannot find package "github.com/prasmussen/gdrive/gdrive" in any of:
/usr/lib/go/src/github.com/prasmussen/gdrive/gdrive (from $GOROOT)
/home/joev/Downloads/gdrive/src/github.com/prasmussen/gdrive/gdrive (from $GOPATH)
drive.go:7:2: cannot find package "github.com/prasmussen/gdrive/util" in any of:
/usr/lib/go/src/github.com/prasmussen/gdrive/util (from $GOROOT)
/home/joev/Downloads/gdrive/src/github.com/prasmussen/gdrive/util (from $GOPATH)
drive.go:8:2: cannot find package "github.com/prasmussen/google-api-go-client/googleapi" in any of:
/usr/lib/go/src/github.com/prasmussen/google-api-go-client/googleapi (from $GOROOT)
/home/joev/Downloads/gdrive/src/github.com/prasmussen/google-api-go-client/googleapi (from $GOPATH)
drive.go:9:2: cannot find package "github.com/voxelbrain/goptions" in any of:
/usr/lib/go/src/github.com/voxelbrain/goptions (from $GOROOT)
/home/joev/Downloads/gdrive/src/github.com/voxelbrain/goptions (from $GOPATH)
Disclaimer : I am not really a pro at golang , but this is how i have been creating binary for gdrive (in case i need/want to make some changes ) , and ones created , i just copy them (binary) from one system to another , unless the binary is broken or something else is wrong and i cant figure it out .
Note : This is on a centos installation , but i believe it should work on most linux systems with some changes
A good part of this method has been taken from the original documentation ..
Official page - https://github.com/prasmussen/gdrive
Step 1 - Install the Go tools - http://golang.org/doc/install
If you are upgrading from an older version of Go you must first remove the existing version. Linux, Mac OS X, and FreeBSD tarballs
Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
Choose the archive file appropriate for your installation. For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux, the archive you want is called go1.2.1.linux-amd64.tar.gz.
(Typically these commands must be run as root or through sudo.)
Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line (at the end of /etc/profile) to your /etc/profile (for a system-wide installation) or $HOME/.profile:
export PATH=$PATH:/usr/local/go/bin
Step 2 - Install mercurial with the command - yum install mercurial
Step 3 - If the src folder of drive (IE drive/src) does not contain your version of gdrive , get it their with the follow commands -
Set the environment variables like so
- 'export GOROOT= /usr/local/go'
- 'export GOPATH=/path/to/gdrive/folder'
'cd /PATH/TO/GDRIVE/DIRECTORY'
'go get github.com/prasmussen/gdrive'
Step 4 - Ones you have edited the gdrive (optional) and want to complie the program ,
go to the gdrive directory and run 'go build drive.go'
get the 'drive' binary generated and place it in '/usr/local/bin' , make the binary executable with 'chmod +x drive'
Thank you
I was having the same problem on my linux. I get help from you guys thanks a lot.
Also If you guys need more info for linux system check: https://serverkurma.com/linux/google-drive-error-403-user-rate-limit-exceeded-error/