Online
Classroom

Core Go (Golang)

Part of our "Other Languages" courses

3 days


Course Overview

This is a modern, instructor-led, and highly interactive Go programming language course designed to teach you how to read, write and understand Go code. The course teaches you the fundamentals and advanced features of Go. Some of the core concepts that we cover include concurrency, modules, generics, and standard libraries (IO, HTTP, etc), among others. The course is designed assuming students have no prior knowledge of Go.

Course Prerequisites

Students should be familiar with other programming languages such as C, Java, C#, C++, Rust, Javascript/Typescript, Python, etc. Having knowledge of a typed language is an added advantage.

Outline

Introduction to Go

  • history behind the go Language
  • language philosophy
  • Understand the go development environment
  • understand GOPATH (and GOROOT)
  • overview of go tools
  • Popular 3rd party tools
  • setting up a go module
  • building and running go modules
  • Overview of GNU Make for go developers
  • Writing makefiles

Language Basics

  • introduce the language structure (statements, declarations, expressions)
  • Declaring and using identifiers
  • List various ways of declaring variables
  • Introduction to types and their literals
  • Appreciate type inference
  • Use primitive types (strings, integers, floating point, booleans, …)
  • Using type conversion
  • use constant declarations
  • using list expressions for variables and constants
  • Understand and use iota
  • using assignment and incdec statements
  • understand special types any, nil and error
  • introduce panic

Arrays & Slices

  • understand arrays in go
  • declaring array types
  • use the composite literal syntax for array literals
  • accessing elements using index expressions
  • caveats using arrays
  • introduce slices
  • understand the relation between arrays and slices
  • construct slice literals and slice expressions
  • looping through arrays
  • using builtin slice functions (append, copy, …)

Strings and Runes

  • understand strings, utf-8 and byte slices
  • understand the different string literals (e.g, interpreted vs raw)
  • string operations and functions (concatenation, substrings, split, join etc)
  • introduce the rune type
  • use the utf8 package

Maps

  • introduce the map type
  • understand hash-map implementations
  • constructing maps using map literals
  • introduce go's comma ok pattern
  • crud on map elements

Structs

  • introduce structs as a product type
  • defining fields
  • explore various ways of supplying values
  • using anonymous structs
  • embedding fields for composition
  • introduce struct tags and explore use cases

Control Structures

  • recap the role of statements
  • block statements and scoping rules
  • using if-statements
  • adding simple statements to other statements (e.g, initialise scoped variables)
  • introduce the many forms of for-statements
  • using c-style for-loops
  • writing while loops (and how to create do-loops)
  • using for-each for ranges
  • using break and continue
  • introduce switch-statements
  • using fallthrough

Functions

  • introduce function characteristics (and difference from other languages)
  • understand go always by value parameters
  • declaring and calling functions
  • returning one or more values
  • using named return values
  • declaring and calling variadic parameters
  • using structs for named-parameters
  • functions as 1st class values
  • discuss use cases for higher-order functions
  • introduce and declare function types
  • use function literals (aka lambda expressions)
  • introduce and use clojures

Go's Error handling

  • introduce errors as values (and differences with other languages)
  • introduce the error type
  • handling errors
  • explicitly ignoring errors
  • discuss various ways of creating errors
  • appreciate wrapped messages
  • managing errors and (lack of) stacktraces
  • discuss panic and their difference with errors
  • raising explicitly

Defer statements

  • understand the semantics of defer-statements
  • discuss use-cases for defer-statements
  • using defer for ARM
  • declaring multiple defer-statements
  • handling panics using defer

Pointers

  • introduce the concept of pointers
  • list addressable types/values
  • using the address-operator
  • dereference pointers using indirect-operator
  • declaring pointer-types
  • briefly discuss the unsafe package
  • discuss and use pointers as function parameters and return values

Methods & Interfaces

  • how go is and isn't an object-oriented languages
  • define the concept of methods
  • declaring methods on structs
  • discuss receiver pointer vs value
  • methods as values
  • adding methods to other types (including built-in types)

Interfaces

  • introduce interfaces and duck typing
  • declaring and "implementing" interfaces
  • idiomatic use of interfaces in go
  • understand the use for empty interface (and its alias any)
  • using functions to implement interfaces (aka "single abstract method")
  • introduce the type adaptor pattern
  • introduce embedded interfaces
  • using type assertions
  • use the type switch for type based pattern matching

Generics

  • introduce the concept of generics (as type constructors)
  • discuss the scope and limitations of generics in go
  • Defining generic functions using type declarations
  • using embedded interfaces to declare type parameters
  • defining generic types
  • using generics with methods

Concurrency

  • discuss theory behind concurrency (and the relationship with parallelism)
  • introduce Communicating Sequential Processes (CSP)
  • introduce goroutines (and how they relate to threads and green threads)
  • discuss the concept of channels
  • understand buffered channels
  • writing goroutines and using channels for communication
  • protect against resource leaks
  • defining and initialising channel types
  • using channel operators: send and receive
  • using for-range statements
  • introduce the select-statement (and for-select)
  • discuss various concurrently pattern (generators, fan-in, fan-out, timeout, done/quit, once, pools)
  • use wait groups for synchronisation

Context

  • introduce context for scoped values and cancellation
  • passing contexts around
  • understand context trees
  • defining the root context
  • adding and getting values to a context
  • introduce cancellation primitives
  • explicitly cancelling a context
  • using time-out (and deadlines)
  • implementing cancelable goroutine

Modules

  • introduce go's program structure
  • set-up modules
  • understand the role of module paths
  • discuss different ways to organise your files
  • understand go packages
  • writing runnable applications (as apposed to libraries)
  • export identifiers and importing them
  • use internal packages

IO and HTTP

IO

  • introduce the io package
  • introduce io.Reader and io.Writer
  • list built-in behavioural io readers/writers
  • using the decorator pattern to chain behaviour
  • list common sentinel errors
  • using the ioutil package
  • reading/writing files
  • accessing the stdin and stdout

http

server

  • define and configure a Server
  • understand the relation between the http and net packages
  • writing handlers
  • understand the http model (requests, responses, headers, etc)
  • leverage the HandlerFunc type adapter
  • using ServeMux to use url pattern matching
  • discuss 3rd party routers
  • list and use behavioural handlers* (static file serving, redirection)
  • working with various timout configurations (read, write, idle, …)
  • properly implement cancelable handlers
  • understand the use of context in http
  • implement and usemiddleware (including 3rd party)

json

  • working with JSON
  • marshalling/unmarshalling json data
  • using json tags
  • implementing custom codecs (custom marshalling/unmarshalling)
  • improve performance using encoders/decoders (streaming io API)

client

  • define and configure an http Client
  • making http requests
  • handling the response body
  • posting data
  • handling timeouts

Public Events

Currently we have no public courses planned for Core Go (Golang)

Private Events

Do you have a team that needs a Core Go (Golang) course?

Contact Us

Send us a message

This Core Go (Golang) course looks very interesting, I do however have a question