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] Go provides a dynamic growable, associative data type called a map.
A map is a collection of key-value pairs and behaves much like a dictionary does, in that when you query a map with a key you get back the value that was mapped to that key. Let's see how this works. On line 11, map1 is defined as a map of string to string. In this case, both the key and value are typed as strings. Lines 12 to 14 then add three key-value pairs to the map. Retrieving a value back out of the map is done by providing the key name within square brackets as per line 17. You have to remember that maps are typed at compile time and you cannot mix and match types after the map has been declared. For example, line 20 would cause a compile time error since the value attempting to be set is of type int, but the map was originally typed with both the key and values both being of type string. A slightly more advanced version of a map is implemented on line 26.
Here I'm declaring a team map. The player's name is the key. Therefore the key is typed as a string. The value this time is using a custom struct type. The player struct type defined on lines 5 to 8. The entire team map is initialized and loaded on a single line using the curly bracket notation. I'll cover structs in more detail later on.
Running this example produces the following output.
In summary, you've just observed how to use the make function to create and declare a variable of type map, how to retrieve values out of the map by specifying their key, creating and initializing a map in one hit on a single line, and using a custom struct as the data type for the maps value part.
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.