This page is intended for people who are building Digital Rebar Provision plugins.
Prerequisites: go version 1.12 or better. These documents assumes the operator/devloper has the ability to both install and update Golang.
Plugin Build Quickstart¶
The follow is an example quickstart on how to setup Golang, get the source code, and build a plugin. In this document, we are showing how to do this on a stock CentOS 7 system. You can compile Golang binaries on any platform, but setup and usage on different platforms my vary.
With a freshly installed CentOS 7 system, get, install, and setup Golang:
Verify that Golang is installed and working for you:
go get ... syntax to get the source code pieces:
Now, lets move to the plugins directory, and compile a plugin:
You should now have the IPMI plugin compiled for Linux amd64 (64bit) version:
Crosscompile Plugin for Different Platform¶
Crosscompiling with Golang is very easy, and it is controlled with a few basic environment variables:
- defines the Operating System target to build for
- defines the platform architecture to build for
An example to force building Linux amd64 binaries (if you are building on a Mac OS X system, for example):
If your build system is the same Architecture as your target build binaries platform, simply drop the
Mac OS X platforms use
darwin as the
GOOS variable setting if you wanted to compile for a Mac OS X system.