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 firstname.lastname@example.org.
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 can be either unbuffered or buffered. When creating a channel using the make function, you can supply a second optional parameter which specifies a buffer size.
The previous example involved the use of an unbuffered channel, given the size parameter was not specified. An unbuffered channel causes the sender to block immediately after writing its message into the channel, and until the receiver has read it back off the channel. In a buffered channel scenario, the sender blocks only once the buffer has filled up and waits until space becomes available before unblocking. Put another way, when the channel is full, the sender blocks and waits until another goroutine reads off the channel making room by receiving.
In the example provided here, a reader goroutine is setup on lines 10 to 15 to read continuously from a buffered channel of size three declared on line seven. The reader first reads from the channel and then immediately sleeps for a second. A writer function is then established on lines 18 to 23 and is invoked on line 25. The writer writes 10 messages as quickly as possible into the buffered channel.
It immediately prints out a count of how many messages it has actually been able to put into the buffered channel. Now, when this program runs, you will see the numbers one through to four inclusive printed out immediately, and then the remaining numbers five through to 10 are printed out slower at about one per second. This shows the effect of channel buffering. Let's now update line 13 to include a pause of three seconds and then rerun the example a second time. And as expected, we now get a longer pause between messages five to 10.
In summary, you've observed how to use the make function to create a buffered channel, and the effect of channel buffering on the readers and writers to and from the channel.
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.