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] Welcome back. In this demonstration, I'm going to show you how to download and install Visual Studio Code. Microsoft's freely available Visual Studio Code IDE is a great choice for editing and debugging Go-based source code. Aside from the fact that it's free, it also has an excellent Go extension ecosystem, which, when any of these are installed, can provide features such as IntelliSense, code navigation, testing, debugging, and many more.
Let's now begin setting up Visual Studio Code locally and install the popular Go extension. Again, although I'm performing the following steps on a MacBook or macOS, the steps are mostly the same for other operating systems. I'll start by navigating to the Visual Studio Code homepage found at code.visualstudio.com. The homepage is clever enough to know what operating system my browser is running on and therefore presents me with a macOS installer for Visual Studio Code. Clicking it downloads it locally.
Once the installer has completed downloading, I'll simply kick it off by clicking it. After the installer completes, I can fire it up like so. With Visual Studio Code now running, I can click on the Extensions left side menu bar option and then search for Go extensions like so. Next, I'll simply install the following two extensions: Go, this adds in rich language support for Go, and Go Test Explorer, which provides a unit testing explorer view. Both extensions will help to boost productivity when it comes to authoring and testing Go code. Next, I highly recommend installing the complimentary command line Visual Studio Code code utility. Installing this allows you to fire up Visual Studio Code from the command line, or terminal, with the current directory loaded into the workspace. To do so, you need to bring up the command palette. On macOS, the key bindings to do so are Shift + Command + P. Then filter on Shell like so. Finally, select the Install code command in PATH option. Okay, that gets installed in the background, and that's it. We now have a super-productive IDE for developing and debugging Go code. Let's jump in and take it for a quick spin.
We can quickly get a feel for the Go programming experience it provides. From here, I'll fire up the embedded terminal. I'll navigate into a directory where I collate together all of the GitHub repos that I do day-to-day Cloud Academy work in. Now that I'm here, I'll do a quick directory listing. Next, I'll git clone an existing demo Cloud Academy Go repository. I'll use the repo found here, github.com/cloudacademy/godemo. Jumping back into the terminal, I'll now do a git clone. And then navigate into the new godemo directory, and open it up within Visual Studio Code, this time using the command line code utility. Navigating around in the directory view, we can see the various source code files that make up the demo Go application. Opening up the main.go file, we can see a number of cool editing features, such as syntax highlighting.
All of the Go keywords are colorized. IntelliSense, if I type fmt., I can immediately see all of the available exported functions and interfaces. Debugging, I can add a breakpoint on the code like so, and then start up the debugger. Here, we see the application has started up and has hit and stopped on the breakpoint. From here, I can see the local variables available on the stack. I can even edit and change these and see these reflect in the rest of the running program like so. Git source control, I can edit the code and see immediately how the current state differs from the most recent commit. Builds, I can jump into the embedded terminal and perform Go builds, compilations, without having to ever leave Visual Studio Code itself. Unit tests, I can quickly rerun all unit tests and confirm the functional aspects of the codebase.
So that should give you a quick hint of the Go programming experience possible within Visual Studio Code when using the right mixture of Go extensions, and, again, all of this for free.
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, Terraform, Kubernetes (CKA, CKAD, CKS).