by Linda Gregier
Another great language to add to your full-stack developer tool belt is the simple and productive general-purpose programming language of Go.
Through a project started in 2007, Go came to fruition through the efforts of some Google programmers. They took great care in Go’s design to make it clear and consistent in its language features and standard libraries, making Go easy and fun to use.
It’s open-source at it’s best…but don’t forget: it’s case-sensitive!
So let’s get started on the Microsoft Windows 10 operating system. You’ll see just how easy this really is — only a basic working knowledge of GitHub and the command prompt is required. Sure there are other ways of installing and running the program, but with limited coding background I felt this set of instructions was the easiest to understand and follow.
Be sure to follow these steps in their entirety as well as in the correct order (as listed) to save yourself from having to uninstall Go and spend a few hours troubleshooting any installation-related issues.
Phase 1: Install the following in this order
- As Go uses open-source (FREE!) repositories often, be sure to install the Git package here first.
- Navigate to the Go installation website here. Download and install the latest 64-bit Go set for Microsoft Windows OS.
- Follow the instructions on the Go installation program.
- Run the Command Prompt on your computer by searching for “cmd”. Open the command line and type: “go version”
- The output after entering go version should look like this:
Phase 2: Creating your Go work-space
First, confirm your Go binaries: go to your computer’s Control Panel, then to System and Security > System > Advanced system settings, and on the left-hand pane click the Advanced tab. Then click on Environmental Variables on the bottom-right-hand side. Ensure Path under System Variables has the “C:\Go\bin” variable in it.
Then create your Go work-space. This will be in a separate and new folder from where the Go installation files are saved. For example, your G installation files were saved under the path C:\Go and you are creating your Go work-space under C:\Projects\Go
In your new Go work-space folder, set up three new folders:
Phase 3: Create the GOPATH environment variable
Create the GOPATH variable and reference your newly-created Go work-space. Go back to your Control Panel and navigate to System and then Environmental Variables. Then under System Variables click on New.
Next to Variable Name, enter “GOPATH,” and next to Variable Value enter “C:\Projects\Go”
To check that your path has been set correctly, enter “echo %GOPATH%” on the command line.
Phase 4: Test and ensure
Now you’re ready to verify that all is working correctly by opening the command line and typing:
go get github.com/golang/example/hello
Wait for the code to be entirely implemented (this could take a few seconds), then enter in the following in the command line:
If the installation was successful, you should get the following return message: “Hello, Go examples!”
I hope you are successful. And if you run into any errors or confusing messages, comment below with the results of this command line: “go env”
Inspiration for this article came from the following on-line resources which were very easy to understand and helpful when setting up Go on my Windows operating system:
And now you’re ready to become a “Gopher”!