Log In
Join
for free
Log In
Join
for free
Back To Course Home
Advanced Techniques in Go Programming
0% completed
Course Introduction
Course Overview
Introduction to Go
A Quick Introduction to Go
The Advantages of Go
Accessing Go Documentation
Writing Our First Program
Running Go Code
Important Characteristics of Go: Variables
Important Characteristics of Go: Control
Important Characteristics of Go: Loops
Important Characteristics of Go: Getting User Input
Important Characteristics of Go: Error Variables
Important Characteristics of Go: Concurrency Model
Developing the which(1) Utility in Go
Logging Information I
Logging Information II
Overview of Go Generics
Developing a Basic Phone Book Application
Exercise: Introduction to Go
Solution: Introduction to Go
Recap: Introduction to Go
Basic Go Data Types
Introduction
The error Data Type
Numeric Data Types
Non-Numeric Data Types
Integer Conversions: Unicode vs. String Values
The strings Package
Times and Dates
A Utility for Parsing Dates and Times
Working with Different Time Zones
Go Constants
Grouping Similar Data: Arrays and Slices
Slice: Length and Capacity
Selecting a Part of a Slice
Byte Slices
Deleting an Element from a Slice
Connection Between Slices and Arrays
The copy() Function
Sorting Slices
Pointers
Generating Random Numbers
Generating Random Strings
Generating Secure Random Numbers
Updating the Phone Book Application
Exercise: Basic Go Data Types
Solution: Basic Go Data Types
Recap: Basic Go Data Types
Composite Data Types
Introduction
Maps
Storing to a Nil Map
Iterating over Maps
Go Structures
Slices of Structures
Regular Expressions and Pattern Matching
Matching Names and Surnames
Matching Integers
Matching the Fields of a Record
Improving the Phone Book Application I
Improving the Phone Book Application II
Exercise 1: Composite Data Types
Solution 1: Composite Data Types
Exercise 2: Composite Data Types
Solution 2: Composite Data Types
Recap: Composite Data Types
Reflection and Interfaces
Introduction
Reflection
Learning the Internal Structure of a Go Structure
Changing Structure Values Using Reflection
Type Methods
Interfaces
The sort.Interface Interface
The Empty Interface
Type Assertions and Type Switches
Safely Handling Arbitrary Data
The error Data Type
Writing Our Own Interfaces I
Writing Our Own Interfaces II
Working with Two Different CSV File Formats
Limitations of Object-Oriented Programming in Go
Updating the Phone Book Application I
Updating the Phone Book Application II
Exercise 1: Reflection and Interfaces
Solution 1: Reflection and Interfaces
Exercise 2: Reflection and Interfaces
Solution 2: Reflection and Interfaces
Recap: Reflection and Interfaces
Go Packages and Functions
Introduction
Go Packages
Functions
Naming Return Values in Go Functions
Functions That Accept Other Functions as Parameters
Functions That Return Other Functions
Variadic Functions
The defer Keyword
Developing Our Own Packages
Using GitHub to Store Go Packages
A Package for Working with a Database
Getting to Know Our Database
The Design and Implementation of the Go Package
Testing the Go Package
Modules and Creating Better Packages
Generating Documentation
GitLab Runners and Go
GitHub Actions and Go
Versioning Utilities
Exercise 1: Go Packages and Functions
Solution 1: Go Packages and Functions
Exercise 2: Go Packages and Functions
Solution 2: Go Packages and Functions
Exercise 3: Go Packages and Functions
Solution 3: Go Packages and Functions
Recap: Go Packages and Functions
Telling a UNIX System What to Do
Introduction
UNIX Operating System
Handling UNIX Signals
File I/O
Buffered and Unbuffered File I/O
Reading Text Files
Reading a Text File Word by Word
Reading a Text File Character by Character
Reading from /dev/random
Reading a Specific Amount of Data from a File
Writing to a File
Working with JSON
Structures and JSON
Reading and Writing JSON Data as Streams
Pretty Printing JSON Records
Working with XML
Converting JSON to XML and Vice Versa
Working with YAML
The viper Package: Using Command-Line Flags
The viper Package: Reading JSON Configuration Files
The cobra Package I
The cobra Package II
Finding Cycles in a UNIX File System
Embedding Files
ReadDir and DirEntry
The io/fs Package
Updating the Phone Book Application
Exercise 1: Telling a UNIX System What to Do
Solution 1: Telling a UNIX System What to Do
Exercise 2: Telling a UNIX System What to Do
Solution 2: Telling a UNIX System What to Do
Exercise 3: Telling a UNIX System What to Do
Solution 3: Telling a UNIX System What to Do
Exercise 4: Telling a UNIX System What to Do
Solution 4: Telling a UNIX System What to Do
Recap: Telling a UNIX System What to Do
Go Concurrency
Introduction
Processes, Threads, and Goroutines
The Go Scheduler
The GOMAXPROCS Environment Variable
Goroutines
Creating Multiple Goroutines
Waiting for Our Goroutines to Finish
What If the Number of Add() and Done() Calls Differ?
Creating Multiple Files with Goroutines
Channels
Receiving from a Closed Channel
Channels as Function Parameters
Race Conditions
The select Keyword
Timing Out a Goroutine
Closing Go Channels
Buffered Channels
nil Channels
Worker Pools
Signal Channels
Shared Memory and Shared Variables
What Happens If We Forget to Unlock a Mutex?
The sync.RWMutex Type
The atomic Package
Sharing Memory Using Goroutines
Closured Variables and the go Statement
The context Package
Using context as a Key/Value Store
The semaphore Package
Exercise 1: Go Concurrency
Solution 1: Go Concurrency
Exercise 2: Go Concurrency
Solution 2: Go Concurrency
Exercise 3: Go Concurrency
Solution 3: Go Concurrency
Exercise 4: Go Concurrency
Solution 4: Go Concurrency
Exercise 5: Go Concurrency
Solution 5: Go Concurrency
Recap: Go Concurrency
Building Web Services
Introduction
The net/http Package
Creating a Web Server
Updating the Phone Book Application
Using Prometheus for Performance Evaluation
Exposing Metrics
Creating a Docker Image for a Go Server
Exposing the Desired Metrics
Using Prometheus and Grafana to Visualize the Metrics
Developing Web Clients
Using http.NewRequest() to Improve the Client
Creating a Client for the Phone Book Service
Creating File Servers
Downloading the Contents of the Phone Book Application
Timing Out HTTP Connections
Setting the Timeout Period on the Client Side
Setting the Timeout Period on the Server Side
Exercise 1: Building Web Services
Solution 1: Building Web Services
Exercise 2: Building Web Services
Solution 2: Building Web Services
Exercise 3: Building Web Services
Solution 3: Building Web Services
Exercise 4: Building Web Services
Solution 4: Building Web Services
Recap: Building Web Services
Working with TCP/IP and WebSocket
Introduction
TCP/IP
Developing a TCP Client
Developing a TCP Client That Uses net.DialTCP()
Developing a TCP Server
Developing a TCP Server That Uses net.ListenTCP()
Developing a UDP Client
Developing a UDP Server
Developing Concurrent TCP Servers
Working with UNIX Domain Sockets
A UNIX Domain Socket Client
Creating a WebSocket Server
The Implementation of the Server
Using JavaScript
Creating a WebSocket Client
Exercise 1: Working with TCP/IP and WebSocket
Solution 1: Working with TCP/IP and WebSocket
Exercise 2: Working with TCP/IP and WebSocket
Solution 2: Working with TCP/IP and WebSocket
Exercise 3: Working with TCP/IP and WebSocket
Solution 3: Working with TCP/IP and WebSocket
Exercise 4: Working with TCP/IP and WebSocket
Solution 4: Working with TCP/IP and WebSocket
Exercise 5: Working with TCP/IP and WebSocket
Solution 5: Working with TCP/IP and WebSocket
Recap: Working with TCP/IP and WebSocket
Working with REST APIs
Introduction
An Introduction to REST
Developing RESTful Servers and Clients
A RESTful Server
A RESTful Client
Creating a Functional RESTful Server
Working with the Database
Testing the restdb Package
Implementing the RESTful Server
Testing the RESTful Server
Creating a RESTful Client
Uploading and Downloading Binary Files
Using Swagger for REST API Documentation
Exercise 1: Working with REST APIs
Solution 1: Working with REST APIs
Exercise 2: Working with REST APIs
Solution 2: Working with REST APIs
Exercise 3: Working with REST APIs
Solution 3: Working with REST APIs
Exercise 4: Working with REST APIs
Solution 4: Working with REST APIs
Recap: Working with REST APIs
Code Testing and Profiling
Introduction
Benchmarking Code I
Benchmarking Code II
Profiling Code I
Profiling Code II
The go tool trace Utility
Tracing a Web Server from a Client
Visiting All Routes of a Web Server
Testing Go Code
The TempDir Function
The testing/quick Package
Testing Code Coverage
Finding Unreachable Go Code
Testing an HTTP Server with a Database Backend
Fuzzing
Cross-Compilation
Using go:generate
Creating Example Functions
Exercise 1: Code Testing and Profiling
Solution 1: Code Testing and Profiling
Exercise 2: Code Testing and Profiling
Solution 2: Code Testing and Profiling
Exercise 3: Code Testing and Profiling
Solution 3: Code Testing and Profiling
Exercise 4: Code Testing and Profiling
Solution 4: Code Testing and Profiling
Exercise 5: Code Testing and Profiling
Solution 5: Code Testing and Profiling
Recap: Code Testing and Profiling
Working with gRPC
Introduction
Introduction to gRPC
Defining an Interface Definition Language File
Developing a gRPC Server
Developing a gRPC Client
Exercise 1: Working with gRPC
Solution 1: Working with gRPC
Exercise 2: Working with gRPC
Solution 2: Working with gRPC
Exercise 3: Working with gRPC
Solution 3: Working with gRPC
Exercise 4: Working with gRPC
Solution 4: Working with gRPC
Exercise 5: Working with gRPC
Solution 5: Working with gRPC
Recap: Working with gRPC
Go Generics
Introduction
Our First Generic Function
Constraints
Creating Constraints
Defining New Data Types with Generics
Using Generics in Go Structures
Interfaces vs. Generics
Reflection vs. Generics
Exercise 1: Go Generics
Solution 1: Go Generics
Exercise 2: Go Generics
Solution 2: Go Generics
Exercise 3: Go Generics
Solution 3: Go Generics
Exercise 4: Go Generics
Solution 4: Go Generics
Recap: Go Generics
Conclusion
Wrap Up
Appendix A—Go Garbage Collector
Introduction
Garbage Collection
The Tricolor Algorithm
More About the Operation of the Go Garbage Collector
Maps, Slices, and the Go Garbage Collector
Introduction
Let’s get an overview of gRPC in Go.
We'll cover the following
Overview of gRPC
Topics to cover
Overview of gRPC
Get hands-on with 1200+ tech skills courses.
Start Free Trial