Install and Setup
The course is part of this learning path
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] Let's begin with the most basic of Go programs, the quintessential Hello World program.
The following Go code, when executed, will simply print out the string "Hello World." We can then iterate and extend on this application by simply duplicating the "Hello World" message like so, changing it to print out the string, "CloudAcademy DevOps 2020." This time, when we rerun the application, both strings are printed out here. Now, let's begin to break down some of the program structure. On line one, we have the package main statement. Every source code file must start with a package statement.
Package declarations are used to organize and group source code. More on this later, but for now, simply know that a Go program or executable, requires at least one file declared with the package main statement, and having a main function declared within it as does this example. This convention is used by the Go compiler and tells it where the entry point is for the application. At runtime the main function is called first within the main file declared with the package main declaration. Next, lines three to five are used to declare any library imports that are then later referenced. In this example, I'm importing the string formatting library to provide string formatting features.
The main function, as earlier mentioned, provides the entry point for the application. There must always be a single main function declared like so, taking in no arguments and returning nothing. At runtime, Go will automatically find and call the main program to start the program execution. If we attempt to change either the package name from main to, say, not main, or change the main function name from main to not main, the program will neither compile nor run, and in each case return an error as indicated here. So, in summary, if you are building an executable binary, at least one file must be declared with the package main declaration at the top, and it must also have a main function declared with zero arguments and zero return values. Otherwise, the program will fail to compile.
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, GCP, Azure), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, GCP, and Kubernetes (CKA, CKAD, CKS).