Course Overview

Go is an open source project developed by a team at Google and many contributors from the open source community. It combines the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language.

If you are leveraging Go to create applications on the job or on your own, attending this course will help you understand how Go works, and immediately be more productive.

If you are building a team using Go, this will be a great opportunity to get your team on the same page and speaking the same language.

The materials and presentation focus on teaching students how to write clear and robust code to create real-world solutions.  Innovative lab exercises and code samples are provided to reinforce skills and quickly master the topics.

Key Learning Areas

  • Learn the history and design motivation of Go
  • Learn the basic structural elements of a Go program
  • Learn to use the basic types, aggregate types, reference types, and interfaces
  • Learn error-handling strategies
  • Learn to compose types and implement encapsulation
  • Learn how to create a method (receiver function) on a struct
  • Learn about pointers and how they are used
  • Learn how to use the interface type to enforce a contract
  • Learn how and when to use anonymous functions
  • Learn File I/O and path operations
  • Learn how to serialize and deserialize types
  • Learn how to send and receive data using channels
  • Learn concurrency and synchronization techniques
  • And more…

Course Outline

Introduction to Go

  • Learn the features and origins of Go
  • Install and configure Go on your OS
  • Choose an IDE
  • Review Go Packages

Getting Started

  • Learn the basic components of the Go language
  • Examine several common programming tasks
  • Utilize the built-in library
  • Examine keywords and names
  • Learn to declare variables and constants
  • Review variable lifetime and scope
  • Define and use pointers

Working with Basic Data Types

  • Examine and work with numbers, strings, and bools
  • Understand the importance of UTF-8 in Go
  • Use standard packages to manipulate strings
  • Use the constant generator

Arrays, Slices, and Maps

  • Use and understand the relationship of arrays and slices
  • Extend slices using the built-In append function
  • Learn slicing techniques
  • Create hash tables using the map data type

Structs

  • Create user defined data types using struct
  • Use struct literal syntax
  • Learn the rules of comparing structs
  • Learn the mechanism of struct embedding
  • Learn how and when to use anonymous fields

Functions

  • Declare and call a function
  • Return multiple values from a function
  • Define a variadic function
  • Create a recursive function
  • Define and use function objects
  • Define and use anonymous functions
  • When and how to use deferred functions

Error Handling

  • Error-handling strategies
  • Dealing with errors: panic and recover

Methods

  • Review object-oriented programming
  • Learn to declare a method
  • Use structs with methods to build models
  • Learn when to use methods with a pointer receiver

Interface

  • Review object-oriented methodologies
  • Create and use interfaces to enforce a contract
  • Understand interface satisfaction
  • Interface type assertions and switches

I/O and Networking

  • Work with common file operations
  • JSON serialization and marshalling
  • Http client and server implementations
  • Build a simple http server
  • REST: Post and retrieve JSON

Goroutines and Multithreading

  • The need for concurrency
  • Overview of Goroutines and Channels
  • Use buffered and unbuffered channels
  • Use select to wait on multiple channels

Who Benefits

  • Students attending a class should have at least 6 months experience programming in a language such as Java, C / C++, C#.
  • Experience programming in a scripting language such as JavaScript or Python is also sufficient.

Prerequisites

No prior experience with Go is assumed or required.

Attendees will be provided with course materials which include the coursebook in pdf format, dozens of examples of Go, and lab solutions. Example programs are intentionally small and easy to understand, so as to focus on the language without getting sidetracked by complicated algorithms or data structures.