Go to the Go official website to download the Go SDK https://go.dev/dl/.
An example installation looks like this:
wget https://go.dev/dl/go1.17.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.17.4.linux-amd64.tar.gzThen edit your ~/.profile or ~/.bashrc to have this line at the end:
export PATH=$PATH:/usr/local/go/binFor the changes to be taken into action, you need to log in again, or run:
source $HOME/.profileMake sure your go is successfully installed:
go versionIf you need to use go-sqlite, you will need to enable CGO first:
CGO_ENABLED=1 go get github.com/mattn/go-sqlite3
Install bbgo:
go install -x github.com/c9s/bbgo/cmd/bbgo@mainYour binary will be installed into the default GOPATH ~/go/bin.
You can add the bin path to your PATH env var by adding the following code to your ~/.zshrc or ~/.bashrc:
export PATH=~/go/bin:$PATHAnd then, check the version, it should be 1.x-dev:
bbgo versionIf not, try running ls -lh ~/go/bin/bbgo to see if the binary is installed.
If it's already there, it means your PATH is misconfigured.
If you prefer other place for installing the go related binaries, you can set GOPATH to somewhere else, e.g.
export GOPATH=~/mygoThen your bbgo will be installed at ~/mygo/bin/bbgo.
Since the default GOPATH is located at ~/go, you can clone the bbgo repo into the folder ~/go/src/github.com/c9s/bbgo:
mkdir -p ~/go/src/github.com/c9s
git clone git@github.com:c9s/bbgo.git ~/go/src/github.com/c9s/bbgo
cd ~/go/src/github.com/c9s/bbgoDownload the go modules:
go mod downloadAnd then you should be able to run bbgo with go run
go run ./cmd/bbgo runYou can also use the makefile to build bbgo:
cd apps/frontend && yarn install
make bbgoIf you don't need the web interface, you can build the slim version of bbgo:
make bbgo-slimStarts a docker container with the alpine image:
docker run -it --rm alpineRun the following command to install the dependencies:
apk add git go gcc libc-dev sqlite
export CGO_ENABLED=1
go get github.com/mattn/go-sqlite3
go install github.com/c9s/bbgo/cmd/bbgo@latestYour installed bbgo binary will be located in:
/root/go/bin/bbgo version
You can use the above instruction to write your own Dockerfile.