Skip to content

Instantly share code, notes, and snippets.

@saiqulhaq
Created June 15, 2019 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saiqulhaq/e5cea6644047beaaca397379dcdeef37 to your computer and use it in GitHub Desktop.
Save saiqulhaq/e5cea6644047beaaca397379dcdeef37 to your computer and use it in GitHub Desktop.
Learn Go

It's been 4 years I use Ruby for server side, now I want to learn Golang, and this is my notes, based on Build web application with Golang book

Always work from $GOPATH

so change directory and create project directory there

cd $GOPATH

mkdir project

Cheatsheet

go build

go build is for compiling tests.

go clean

go clean is for cleaning files that are generated by compilers

go fmt

format the code

go get

go get is a command to get remote packages, from github, etc

go install

go install this command compiles all package and generates files, then moves them to $GOPATH/pkg or $GOPATH/bin

go test

go test is a command to loads all files whose name include *_test.go, then test it
run go help testflag for more details

another useful commands

  • go env view environment variables
  • go list list all install packages
  • go run compile temporary files and run the application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment