Install and Setup
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 email@example.com.
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
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
To get the most from this course, you should have at least:
- A basic understanding of software development and the software development life cycle
All sample Go source code as used and demonstrated within this course can be found here:
- [Jeremy Cook] Channels are communication objects used by goroutines to communicate and share data with each other. In their simplest incarnation, one goroutine will write messages into the channel, while another goroutine will read the same messages out of the channel. Channels are created using the make function together with the chan keyword. Like variables, channels are typed and as such can be used to transport messages only of that data type, for which was declared with.
To write data into a channel, you first specify the name of the channel followed by the left arrow syntax, and then the data itself. This style of syntax is highly readable, since the data always flows in the direction of the arrow, making the concept of message passing and processing quite easy to understand.
Reading data off the channel involves moving the left arrow syntax to the front of the channel name. In the example shown here, the main function first declares a message channel of type string on line six. Next, an anonymous goroutine is declared on lines spanning eight through to 12. Inside this anonymous goroutine, three individual messages are written into the channel. The main function then concludes by reading back off the channel, each of the three messages. Let's run this example and examine the resulting output. And, as expected, we get the result Cloud Academy 2020.
In summary - you've observed; How to use the make function together with the chan keyword to create typed channels. How to write messages onto the channel. And then how to read the messages back off the channel. Note: Channels act as first-in-first-out queues. For example, if one goroutine writes messages into a channel and a separate goroutine reads them off the channel, then the messages will be received in the exact same order sent.
About the Author
Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.
Jeremy holds professional certifications for both the AWS and GCP cloud platforms.