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] When it comes to understanding the visibility of variables, constants, and/or functions et cetera, it's important to understand that any of them declared outside of any function are visible across the entire package in which they were declared, regardless of whether their names are capitalized or not.
To put it another way, all files that belong to the same package have visibility of them. This is irrespective of the exporting naming convention previously reviewed. Therefore, any variable, constant, and/or function whose name starts with either a lowercase or uppercase character will be visible and available in all other source files that share the same starting package name statement. In the example provided here, we can see that the util package which now consists of two source files, the x.go and y.go files. File x.go spans lines five to 19, and file y.go spans lines 21 to 29.
Both of these files belong to the same util package as per the package statements at the top of each file. The y.go file declares an unexported getY function on lines 26 to 28. Even though this function is unexported, it can still be called upon within the x.go file as demonstrated within the GetXY function declared on lines 16 to 18. Again, the reason for this is that both the x.go and y.go files belong to the same util package. Therefore, each can see all of the each other's variables, constants, and/or functions et cetera, that have been declared outside of any other function. Running this example produces the result 60,000.
The explanation for this follows. The main function makes a call to the exported util.GetXY function on line 39. This function returns the result of multiplying little x, a constant whose value is 200, by the unexported but still visible getY function. This is the key point of this example. The fact that the getY function is still visible within the x.go file, even though it was declared in the y.go file and by naming convention is unexported. The reason that this is all possible is due to the fact that both files, x.go and y.go belong to the same util package. The getY function returns the value 300, which is the value stored in the constant y. Finally resulting in the multiplication of 200 times 300, which we know equals 60,000.
In summary, you've observed source files belonging to the same named package can see each other's variables, constants, and/or functions et cetera, if they were defined outside of other functions, and regardless of whether they were exported or not.
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).