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] When it comes to creating custom data types, Go provides the Struct keyword. A Struct provides you with the capability of creating a typed collection of related fields. They are used to create custom data types by combining multiple related attributes together. Structs can be nested within each other, enabling you to build up custom types that have a hierarchy of related fields.
In the example presented here, two custom structs are declared. The person struct, defined on lines five to eight, defines a person type abstraction which is used to represent a person's first name and surname. The second struct type, spanning lines 10 to 14, defines a lecture data type abstraction, used to represent a lecture which has a given name, is presented by an instructor, and has a duration. The instructor field within the lecture struct on line 12 is typed using the previously declared person struct. This demonstrates how to perform composition using structs.
Later on within the main function, spanning lines 18, 19, and 20, three lecture literals are created using curly bracket syntax. This both creates and initializes the struct. Each lecture is added directly into the lectures slice. Beginning at line 23, a for loop is used to iterate over the lectures slice. Dot notation is then used to access the individual fields of the lecture struct. This is used to read back out the name, the instructor, and the duration of each lecture. Dot notation is the standard syntax for navigating within structs. Running this example produces the following output.
In summary, you have just observed how to create a custom struct collecting related fields into a new data type abstraction, how you can use composition to create structs that contain other structs, and how to use dot notation to navigate and access the individual fields within a struct.
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.