This repository is a collection of my personal Go source code while doing the learning process.

  • By Jidni Ilman
  • Last update: Mar 31, 2022
  • Comments: 0

Learning Go

This repository is a collection of my personal Go source code while doing the learning process.

Materials

Below is the list of materials for my learning

1. Programming with Google Go Specialization

Commands

go build

Compile the program

go build main.go

go doc

Show the documentation

go doc <pkg>

go fmt

Format source code files

gofmt -w .       # formats files in current directory and all sub-directories
go fmt ./...     # similar to previous
go fmt .         # formats files in current package
gofmt -w foo/bar # formats files in directory $PWD/foo/bar and sub-dirs
go fmt foo/bar   # formats files in directory $GOPATH/src/foo/bar
gofmt -w         # error, no file or directory specified
go fmt           # formats files in current package

go get

Download packages and install

go get <pkg>
go get -u <pkg> # also update all its dependencies

go list

List all installed packages

go list

go run

Compile and run the executables

go run main.go

go test

Run tests file

go test

Download

learning-go.zip