Profiling, Debugging, and Advanced Testing Techniques
By Gopher Guides
This course will walk you through installing Go, setting up your
GOBIN to your path. It will also test to ensure the installation and
environment is properly set up. Finally, it will discuss several options for
Go comes with a powerful set of tools for profiling and improving the performance of your code. Benchmarking is one of those tools, and the first one most developers start with. In this module we will cover basic benchmarking, some common benchmarking mistakes, and how to compare benchmarks to see if performance has improved.
Go ships with a number of profiling tools. This chapter will walk you through how to:
- Use interactive
pprofwith a cpu profile
- Use interactive
pprofwith different types of memory profiles
- Generate profiles from benchmarks
- Generate profiles from live/running applications
- Generate torch graphs from benchmarks or live/running applications
While it's not common to have to make heavy use of
reflection in Go, there
are certainly times it's required. This module will cover likely scenarios you
would need reflection, as well as how to use the reflection package.
Go provides a tool that allows you to generate code. This can be useful for many tasks, from dynamically updating included content embedded in a binary to generating generic code for reuse across types.
Many times you may be testing parts of your code that have service dependency that run for an unknown amount of time.
Examples of these may be task queues, distributed system calls, etc.
Because you don't know how long they may take to execute, testing them can present some challenges.
In this module we will learn how to set up tests both effectively and efficiently for testing async processes.
It's easy to decouple packages in Go using interfaces. Because of this, testing can also be much easier. However, you typically want to mock out your interfaces in tests so that unit testing is much easier. This chapter will cover how to write a mock for a service to enable easy and precise testing.
Package management is essential in creating repeatable builds in your software.
This module will cover how to use
Dep as well as cover the up and coming
Delve is a source level debugger for Go. In this module, we will learn how to launch Delve and interactively debug a program.
Google App Engine - Standard Environment (GAE) is an infrastructure abstraction that lets you host applications in Google Cloud Platform. It has an impressive free quota that small apps will never exceed, and is affordable for larger scale application too.
It comes with a range of common services, such as data storage, email, task queues, cron jobs, authentication, image manipulation, and more.
Typically we write the application on a development machine, and deploy it using command line tools provided by Google.
Once deployed, the platform ensures instances are ready to handle requests from users. It auto-scales the applications to meet demand, and provides tools and services to help manage and operate the application. We use the Google Cloud Platform Console to interact with our hosted application in production.
Google App Engine supports Go natively, and this module will explain how to use it.
SPECIAL PRICING - LIMITED TIME OFFER
This course will take you show you how to profile your Go code. Starting with basic benchmarks, all the way through system and memory profiling. Continue even further by using and understanding flame graphs. Load up
Delve, an interactive Go debugger, and track down those annoying bugs. Learn about advanced concepts in Reflection, how to use the built in code generators, and finally, advanced concepts in mocking and testing asynchronous tasks.