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] The For keyword provides you with the ability to implement control loops. There are various ways in which it can be implemented.
The first for loop example as displayed here on lines nine to 14, will continue to loop forever until the break keyword is encountered. In this case, we test the value of the variable x which was declared previously outside the scope of the for loop itself. Each cycle of the for loop increments the x variable by one meaning eventually it will exceed the tested limit of two, ensuring that the if statement is entered and therefore the break statement within it is executed with the result being the for loop is exited entirely.
The second for loop spanning lines 16 to 19 shows a second form of the for loop in which it declares a condition only. In this case it will continue looping while y is less than three.
The third and final for loop implemented across lines 21 to 26 shows you how to implement it where the variable z is both declared and initialized as part of the for statement itself and includes both the test case and an increment operator in the form of the ++ operator. This for loop shows you how to use the continue keyword to return control flow immediately back to the for loop, meaning it will perform the next loop without executing the remaining statements that follow the continue keyword. Running this example produces the following output, the number three for the first for loop, the numbers zero, one, and two for the second for loop, and the numbers eight and nine for the third for loop.
In summary, you've just observed the basic alternate forms of the for statement and how it can be used perform looping. And how the break and continue keywords can be used to alter the loop cycle flow A couple of notes on the for keyword. For is the only loop statement in Go, but, as seen, has alternate forms. And when declaring a for loop without a condition, it will loop forever until it encounters a break or a return from the enclosing function.
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.