The go programming language

Shaun McFee presented an introduction to the go programming language.

Supposedly, the go programming language was conceived while waiting on a build. It was created via consensus by Robert Griesemer, Rob Pike and Ken Thompson. They included only the features all three developers felt were needed. The language was designed within Google to address problems at scale in terms of the size of the codebases and the teams.

Objective: make large scale projects more efficient in terms of build times, dependency management and onboarding developers.

Characteristics

  • general purpose but designed for systems programming
  • especially suited to server/infrastructure software
  • includes built-in support for channel-based concurrency
  • arguably the cloud-native systems language
  • Docker, Kubernetes, and Terraform are written in Go
  • likened to C/C++ in terms of efficiency
  • statically typed and compiled but has a garbage collector
  • designed to be efficient to build as well as run
  • focused especially on efficient dependency management
  • likened to Python in terms of simplicity and readability
  • has only 25 keywords and no inheritance
  • open source but must maintain compatibility with Go 1
  • described as both fun and boring
  • fun in that it is productive and easy to use
  • boring in that features aren’t added for their own sake
  • intentionally does some things its own way
  • unusual import/export enhances readability

Tools

  • pkg.go.dev: search for go packages
  • go run: compile a go application (i.e. a main package) if needed, and run it
  • go help: show help for the go command
  • go mod init: initialize a go module by generating a go.mod file
  • go build: compile a go application if needed without installing it, or compile a library or libraries (i.e. non-main packages) if needed, and discard the resulting object, essentially checking that it/they build
  • go test: run tests for a go package
  • go list: list information about named packages or the current package, defaulting to the import path for each package
  • go env: display or change the go environment
  • go install: compile and install the named application or the current application to the directory specified by the GOBIN environment variable

Resources

All articles

Read more: