Programming & Web DevelopmentIntermediate

Go Programming Fundamentals

Goroutines, channels, modules and building a web service in Go.

Taught by Suman Ghimire · DevOps Engineer

What you'll learn

  • Create, build and manage Go projects with modules and the go command
  • Model data with structs, methods and small interfaces that types satisfy implicitly
  • Handle failures with error values, wrapping, errors.Is and errors.As instead of exceptions
  • Write safe concurrent code with goroutines, channels, sync.WaitGroup and context cancellation
  • Build a JSON REST API with net/http routing, timeouts and graceful shutdown
  • Test Go code with table-driven tests and httptest, then ship it as a static binary in a container

About this course

Learn Go, the language behind Kubernetes, Docker, Terraform and much of today's cloud-native tooling, and finish by building and testing a production-shaped web service. This intermediate course is for developers who already know another language, such as Python, JavaScript or Java, and want to write fast, simple back-end services, command-line tools and DevOps automation. You will set up Go modules and the go toolchain, master slices, maps, structs and interfaces, and handle errors the idiomatic Go way. You will then write concurrent code with goroutines, channels and context, build a JSON REST API with the standard library net/http router, and cover it with table-driven tests, httptest and benchmarks before packaging a static binary in a small container image. You should be comfortable with variables, functions and basic HTTP concepts; no prior Go experience is needed.

Course content

7 lessons
  1. 1Why Go and Your First ModuleWhere Go shines in cloud-native work, installing the toolchain and running your first module.Preview
  2. 2Syntax Essentials: Types, Slices and MapsVariables and zero values, functions with multiple returns, and the slices and maps you will use daily.
  3. 3Structs, Methods and InterfacesModel data with structs, attach behaviour with methods and decouple code with implicit interfaces.
  4. 4Errors the Go WayTreat errors as values, wrap them with context and inspect them with errors.Is and errors.As.
  5. 5Concurrency with Goroutines and ChannelsRun work concurrently with goroutines, coordinate it with channels and WaitGroups, and cancel it with context.
  6. 6Building a Web Service with net/httpBuild a JSON REST API with the standard library router, sensible timeouts and graceful shutdown.
  7. 7Testing, Benchmarking and Shipping Go CodeWrite table-driven tests, test HTTP handlers with httptest, benchmark hot paths and build small container images.