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] In the previous demonstration, I showed you the basics of working with pointers, how to create and initialize them, how to de reference them, and how to re point them, etc. In this demonstration, I want to explain why they are useful and the situations that you should consider using them. In the example provided here, I've implemented two string based functions, notString and notStringPtr. Both functions simply take a single input parameter of type string. The function is then designed to simply attach the string "not" to the front of the input string.
Note here that both functions do exactly that, and nothing else, they don't even have a return value. In the main function a message variable is created and initialized with the string "cloudacademy". We then call the first function, the notString function on line 16, passing in the message variable. When execution returns from this function, we immediately print out the message variable to find that it still holds the same initial string "cloudacademy". This function and in particular its' input parameters use a copy by value approach, that is the parameters as used within the function are copies of the variables that are passed into the function. Next, we call the second function, the notStringPtr function on line 19, again passing in the same "cloudacademy" message. When execution returns from this function, we immediately print out the message variable to find that it now contains the updated string "notcloudacademy".
So why the change in behavior? Well, if you take a closer look at the 2 different function implementations, in particular the signatures, you will find that the notStringPtr function actually takes in a pointer to a string input parameter. The message input parameter is then de referenced with the string concatenation operation now taking place on the exact same string held in the exact same memory location that the original message variable declared in the main function points at. This function and in particular its' input parameters use a copy by reference approach, that is the parameters as used within the function are direct references to the variables that are passed into the function.
Declaring an input parameter as a pointer to a data type, allows you to manipulate the contents of that parameter within the function and then to have those updates available back outside of the function. This is one of the main motives for using pointers. Another area where pointers are beneficial, is the scenario where you have a variable that holds a very large amount of data and you need to pass this variable into a function. Using a pointer prevents you from having to recopy and duplicate all of the data, keeping your memory space free.
In summary, you've just observed that input parameters can be typed as pointers, and that this allows the function to modify the data stored within the parameters such that the modification are then available outside of the function.
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.