In the example shown next, we are going to set up a Go environment to run InfluxDB with Go client.
- Install Go.
Install Go by following the golang installation guide available at:
https://golang.org/doc/install
Set up GOROOT and GOBIN:
sudo apt install golang-goexport GOROOT=/usr/lib/goexport GOBIN=/usr/bin/go
Set up $GOPATH:
mkdir ~/goexport GOPATH=~/goexport PATH=$PATH:$GOPATH/binexport PATH=$PATH:$GOROOT/bin
Check the Go version:
$ go versiongo version go1.6.2 linux/amd64
- Install the InfluxDB Go client library:
go get github.com/InfluxDB/InfluxDB
You should see a message similar to the following:
package github.com/InfluxDB/InfluxDB: code in directory /home/user/go/src/github.com/InfluxDB/InfluxDB expects import ...