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 support@cloudacademy.com.
Learning Objectives
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
Intended Audience
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
Prerequisites
To get the most from this course, you should have at least:
- A basic understanding of software development and the software development life cycle
Source Code
All sample Go source code as used and demonstrated within this course can be found here:
- [Jeremy Cook] Creating a new module is performed by running the command go mod init with the module name. This command should be performed within the module's root directory. For example, running the follow command creates and initializes a new module. The outcome of executing this command is a new go.mod file.
Taking a look at this file, we can see that it contains the following. Next, if we now run the command go get, the module dependencies that this module relies on as per the import package statements throughout the source code, will be scanned for and then downloaded. With the results then written back into the go.mod file, using one or several require directives. Let's try this out!
The result of running this command is that the module's dependencies would've been discovered, downloaded and written back into the go.mod file. Reexamining the go.mod file, we can see that it has now been updated. Additionally, a new go.sum file is generated and placed into the same directory containing the go.mod file. The go.sum file contains cryptographic checksums of each of the downloaded modules. This is used to maintain the integrity of the downloaded modules, ensuring that modules aren't either intentionally or unintentionally changed. The go in mod verify command can be invoked at any time there afterwards, to recompute and compare checksums, to determine modifications. When it comes to source code management, both the go.mod file and go.sum files should be committed into your source code repository.
The actual downloaded module dependencies do not themselves need to be added, since anyone with access to the go.mod and go.sum files can rebuild the local dependency cache. Mostly, the go.mod file can be left alone. You don't need to manually maintain it, unless you want to explicitly declare a dependency on a particular module version. Your typical coding workflow will involve creating new go source files, in which you add your required import statements.
Whenever you call go build, or go run, or go test, the new module dependencies will be detected, and automatically downloaded to satisfy the new import statements. When this happens, the go.mod and go.sum files will be automatically updated to reflect the latest dependency requirements.
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).