go cheat sheet
Go cheat sheet

Go cheat sheet

Install Go

Mac

brew install go

Ubuntu

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update
sudo apt-get install golang-go

Windows

choco install golang
choco install git

In case you don’t have Chocolatey, install it using an administrative cmd.exe (details see here):

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Get Fyne examples running

Mac

go get github.com/fyne-io/fyne
go get github.com/fyne-io/examples
cd ~/go/src/github.com/fyne-io/examples
go run main.go

Ubuntu

go get github.com/fyne-io/fyne
sudo apt install libx11-dev
sudo apt install libxcursor-dev
sudo apt install libxrandr-dev
sudo apt install libxinerama-dev
sudo apt install mesa-common-dev
sudo apt install libgl-dev
sudo apt install libxi-dev
go get github.com/fyne-io/examples
cd ~/go/src/github.com/fyne-io/examples
go run main.go

Windows

choco install mingw
go get github.com/fyne-io/fyne
go get github.com/fyne-io/examples
cd %GOPATH%\src\github.com\fyne-io\examples
go run main.go

cgo

  • On Mac OS, make cgo use gcc (installed via brew) instead of /usr/bin/g++ (i. e. XCode Clang)

    export CC_FOR_TARGET=/usr/local/bin