Skip to main content

Set up Golang environment

Installation

info

Testing platform: Linux Ubuntu 18.04

Ubuntu requirements

sudo apt-get install curl git mercurial make binutils bison gcc build-essential bsdmainutils

GVM

It is a GO version manager.

Make sure you already installed zsh.

zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

Steps

gvm install go1.18 -B
gvm use go1.18 --default
export GOROOT_BOOTSTRAP=$GOROOT

For ARM Jetson devices

Basic image: ubuntu:20.04

Docker Env

docker run --name=go_env -it -v /home/nvidia/chieh/sol_cli:/workspace ubuntu:20.04 bash

Steps

sudo apt-get install curl git mercurial make binutils bison gcc build-essential
sudo apt-get install bsdmainutils

bash < <(curl -s -S -L <https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer>)

gvm install go1.18 -B
gvm use go1.18 --default
export GOROOT_BOOTSTRAP=$GOROOT

If you wanna keep working on your original repository.

go mod tidy

Start a new repo:

go mod init (repo name)
go mod tidy
go get github.com/urfave/cli