O'Reilly logo
live online training icon Live Online training

Mastering Go for UNIX administrators, UNIX developers and Web Developers

Take your Go knowledge to the next level!

Mihalis Tsoukalos

Go is a modern and very popular open source programming language that started as an internal Google project and was officially announced at the end of 2009. The advantages of Go include code that is portable, secure, easy to read, write and understand, support for concurrent programming and garbage collection, a rich standard library, support for Unicode and executable files that are statically linked as well as support for web applications and a web server that can be used for testing purposes. Last, Go is a relatively easy to learn programming language provided that you spend the necessary time to study it.

The purpose of this is course will is help you learn some of the advanced features of Go that will make you a better and more successful Go developer.

So, In this course you will learn how to create various types of Go functions, use the various types of Go channels, benchmark Go code, use the flag package for processing command line arguments and use shared variables as well as understand how the Go Garbage Collector and Go Scheduler work.

What you'll learn-and how you can apply it

  • Work with Go functions
  • Understand the way the Go Garbage Collector and the Go Scheduler work
  • Understand the different kinds of Go channels
  • Develop a Go program that uses shared memory and shared variables
  • Benchmark Go functions
  • Create UNIX command line utilities that use the Go flag package
  • Develop a concurrent TCP server in Go
  • Understand what is Go package versioning and how it works

This training course is for you because...

  • You're a UNIX developer, administrator or web developer that already knows the basics of Go and wants to take their Go knowledge to the next level by understanding the internals of Go, taking advantage of Go channels, using shared variables, learning the capabilities of Go functions and being able to benchmark their Go code to find out what really slows down their programs.


  • A working UNIX system like Linux and macOS – any UNIX system with a recent Go installation will do.
  • Basic knowledge of a UNIX shell – the bash shell will be used in this Live Course but you can use any UNIX shell you like.
  • Basic knowledge of Go including compiling and executing Go code, creating Go functions, processing command line arguments and creating basic TCP/IP applications.

Recommended Preparation:

Mastering Go (book)

Materials, downloads, or Supplemental Content needed in advance:

  • A recent Go installation.
  • A text editor such as vim, Emacs or TextMate.

About your instructor

  • Mihalis Tsoukalos is a UNIX administrator, programmer, DBA, and mathematician, who enjoys writing technical books and articles and learning new things. He has written more than 250 technical articles for many magazines including Sys Admin, MacTech, Linux User and Developer, USENIX; login:, Linux Format, and Linux Journal. His research interests include databases, operating systems, Statistics, and machine learning.


The timeframes are only estimates and may vary according to how the class is progressing


Section 1: The Go Garbage Collector and Scheduler (30 mins)

  • The Tricolor Algorithm
  • The mark-and-sweep Algorithm
  • The Go Garbage Collector
  • The Go Scheduler

Section 2: Functions, the flag Go package and Go Interfaces (1h)

  • Go Functions revisited
  • The flag standard Go package
  • A gentle introduction to Go Interfaces


Lab 1: Go functions (20 mins practice + 10 mins solution)

  • Write a Go function that returns multiple values
  • Write an anonymous Go function
  • Write a function that returns another function

Lab 2: Using the flag package (20 mins practice + 10 mins solution)

  • Creating a UNIX command line utility that uses the flag package
  • Alternatives to the Go flag package


Section 3: Benchmarking Go code (1h)

  • Benchmarking Go code
  • A simple benchmarking example
  • A wrong benchmark function
  • Benchmarking mathematical functions
  • Benchmarking File I/O operations

Lab 3: Benchmarking Go code (15 mins practice + 15 mins solution)

  • Benchmarking mathematical functions
  • Examining the results


Section 4: Go Channels revisited (1h)

  • Reading from a Go channel
  • Writing to a Go channel
  • Panicking a Go channel
  • The different kinds of Go Channels
  • What you should know about Go channels

Lab 4: Go Channels in action (20 mins practice + 10 mins solution)

  • Panicking a Go channel in action!
  • Developing a concurrent Go program that uses channels


Section 5: Shared memory and shared variables (1h)

  • About shared memory and shared variables
  • The sync.Mutex and sync.RWMutex types
  • Implementing shared variables in Go

Lab 5: Using Shared variables in Go (20 mins practice + 10 mins solution)

  • Using sync.Mutex

Lab 6: Developing a Concurrent TCP server (20 mins practice + 10 mins solution)

  • Developing a concurrent TCP server in Go


Section 6: Go Package Versioning (30mins)

  • About Go package versioning
  • Go package versioning in action