Skip to content

Latest commit

 

History

History
140 lines (95 loc) · 3.48 KB

File metadata and controls

140 lines (95 loc) · 3.48 KB

Build SaltStack Plugin Development Environment

English / 中文

Notice: pay attention to the user execution permission.

Build Linux Development Environment

  1. Firstly, make the directory on the linux host.
mkdir -p /data/gowork/src/github.com/WeBankPartners/
  1. Download and decompress Golang binary package.
cd /data/
wget https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz 
tar xzvf go1.12.9.linux-amd64.tar.gz 
  1. Set Golang environmental variables. Make file golang.sh under directory /data/ with the following content:
export GOROOT=/data/go
export GOPATH=/data/gowork
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
  1. Run the command to make it effective.
source /data/golang.sh
  1. You can run go version to make sure successful.
go version
  1. Clone SaltStack Plugin source code.
cd /data/gowork/src/github.com/WeBankPartners/
git clone https://github.com/WeBankPartners/wecube-plugins-saltstack.git
  1. Build the source code.
cd /data/gowork/src/github.com/WeBankPartners/wecube-plugins-saltstack
go build 

Build Windows Development Environment

  1. Make directory D:\gowork\src\github.com\WeBankPartners.

  2. If your computer haven't installed git client yet, please install Git for Windows.

  3. Install Golang for Windows. During installation, please change the installing directory to D:\go.

  4. After installation, input the command go version to view the Golang version.

  5. Set environmental variables GOROOT and GOPATH:

GOROOT=D:\go
GOPATH=D:\gowork
  1. Git clone SaltStack plugin source code. In the cmd, change the directory to D:\gowork\src\github.com\WeBankPartners and run the following command.
git clone https://github.com/WeBankPartners/wecube-plugins-saltstack.git
  1. Build SaltStack plugin source code. Please go into D:\gowork\src\github.com\WeBankPartners\wecube-plugins-saltstack and run go build in the cmd command line.
go build 

Build Mac Development Environment

  1. The first need Golang installed. Use brew to install Golang, as follow.
brew install go
  1. You can use go env to view the Golang version. The GOROOT displayed at this time is the installation directory where you installed the Golang using brew.

  2. Set Golang environmental variables.

vim ~/.bash_profile

Set values for GOROOT、GOPATH、GOBIN、PATH

GOROOT=/usr/local/go
export GOROOT
export GOPATH=/Users/gowork/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN:$GOROOT/bin

Make it effective

source ~/.bash_profile
  1. Please make the directory, as follow.
mkdir -p /Users/gowork/go/src/github.com/WeBankPartners/
  1. Git clone SaltStack Plugin source code.
cd /Users/gowork/go/src/github.com/WeBankPartners/
git clone https://github.com/WeBankPartners/wecube-plugins-saltstack.git
  1. Build SaltStack Plugin source code.
cd /Users/gowork/go/src/github.com/WeBankPartners/wecube-plugins-saltstack/
go build