The course is part of this learning path
If you're thinking about engineering the next big dotcom application then you should seriously consider using Go!!
The Go Programming Language is without doubt one of the hottest languages to learn, particularly in this cloud native era. More and more companies are adopting Go to engineer highly performant, stable and maintainable applications. Popular projects such as Docker, Kubernetes, Terraform, Etcd, Istio, InfluxDB have all been built successfully using Go!!
This introductory level training course is designed to bring you quickly up to speed with the many key features that the Go programming language provides. You'll also learn how to setup your own Go development environment - consisting of the Go toolchain, Visual Studio Code, and several related Go based extensions - all to ensure that you are able to be productive writing your own source code.
We’d love to get your feedback on this course, so please give it a rating when you’re finished. If you have any queries or suggestions, please contact us at support@cloudacademy.com.
Learning Objectives
By completing this course, you will:
- Learn about what makes Go a great language
- Learn how to install the Go toolchain
- Learn how to setup Visual Studio Code to edit and debug Go programs
- Learn how to work with the Go Playground to test and run snippets of Go code
- Learn and understand the basic Go language syntax and features
- Learn how to use the Go tool chain commands to compile, test, and manage Go code
- And finally, you’ll learn how to work with and manage Go modules for module dependency management
Intended Audience
This course is intended for:
- Anyone interested in learning the Go Programming Language
- Software Developers interested in using Go to compile and test Go based applications
- DevOps practitioners looking to learn about Go to support Go based applications
Prerequisites
To get the most from this course, you should have at least:
- A basic understanding of software development and the software development life cycle
Source Code
All sample Go source code as used and demonstrated within this course can be found here:
- [Jeremy Cook] Go provides several very cool language features that specifically address concurrency and asynchronous program flow requirements.
Fundamental to these features is the concept of a goroutine, which is implemented using the go keyword. Goroutines can be thought of as conceptually like lightweight threads, although they are not strictly threads in the sense of what the operating system sees and manages. Instead, goroutines are managed and scheduled by the Go runtime and done entirely within the virtual space of the Go runtime. Goroutines enable you to start up and run other threads of execution concurrently within your program. They are designed to be lightweight with minimal overhead, meaning you can literally spin up thousands of these without incurring performance penalties. Let's take a quick look at an example that uses goroutines to async some of the program flow within it.
In the example shown here, the doSomething function declared on lines 14, 15, and 16 implements the sequence whereby it pauses itself for a random amount of time, somewhere between zero and three seconds, and then resumes and prints out the inputted message. Back within the main function, the doSomething function is called synchronously on lines 20 and 26, seeded with the messages sync1 and sync2, respectively. On lines 22, 23, and 24, three goroutines are started, each with their own specific message, indicating that they are async executed.
Let's now run this example and examine the resulting output. Here, we can see that the order of the messages is different to the order as seen in the code. The reason for this is that the goroutines all run at approximately the same time concurrently. And since they are each required to pause for a random amount of time, the order in which they wake up and resume will be different. Note, the final time.Sleep function, as used on line 28, is a quick and basic approach to allowing the program's goroutines to complete before the main program execution does. I'll show some better techniques as to how to manage this aspect when working with concurrency within Go as the course proceeds.
In summary, you have observed how to create goroutines using the go keyword to start concurrent flows of execution.
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).