Skip to main content
Compile from Source
Barracuda Admin avatar
Written by Barracuda Admin
Updated over 2 years ago

Compiling access-cli from source is recommended only if you intend to make changes to its source code. Otherwise, Barracuda Networks recommends installing access-cli via Homebrew or from the packages available on the releases page.

Prerequisites

  • Go (version 1.13 or higher)

  • go-swagger – access-cli is developed and tested using v0.21.0

Obtaining the Code

access-cli uses the modules support introduced in Go 1.11, which means you are not forced to place the code in a specific path under GOPATH. You can clone the repository into any folder:

git clone https://github.com/barracuda-cloudgen-access/access-cli
cd access-cli

You can also clone the repo into the usual $GOPATH/src/github.com/barracuda-cloudgen-access/access-cli path, but keep in mind that the project will not compile until the next step is complete (i.e., go get github.com/barracuda-cloudgen-access/access-cli will always fail).

Generating Code from the Swagger Specification

After installing go-swagger, run the following command on the root of this repo:

swagger generate client -f swagger.yml

This will generate the client and models packages. The code in the cmd package depends on these.

Compiling

Simply run go build. Because we are using Go modules, Go will take care of downloading the correct versions of the dependencies.

You should now have a access-cli executable. You can install the package, if you wish, which will place the binary in $GOPATH/bin.

Did this answer your question?