InfluxDB with Go client

In the example shown next, we are going to set up a Go environment to run InfluxDB with Go client.

  1. 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
  1. 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 ...

Get Seven NoSQL Databases in a Week now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.