Golang is a great language for systems programming, back-end development, creating web applications and cloud computing. If you search for Golang development company today, you will get several results. This goes on to show how popular Golang is becoming with each passing day.
As a budding developer, wouldn’t you want to hop on the Golang train? Not only would you get to learn an amazing language, but your career prospects will improve drastically. So, what are you waiting for? Install Golang today and get started.
Download and Install the Go Compiler
The Download Part
In order to download the Go compiler, you have to follow the steps mentioned below:
- Go to Google and type ‘Go’
- Click on the search result ‘The Go Programming Language’ or the link https://go.dev
- Click on the ‘Downloads’ option and from the ‘Featured downloads’ section, you have to choose Microsoft Windows.
- Choose the Microsoft Installer file, i.e, go1.19.windows-amd64.msi. As you do so, the 136 MB file will get downloaded.
The Installation Process
Now, we move on to the installation part.
- Click on the downloaded .msi file. As you do so, the go setup screen will appear.
- You have to click on ‘Next’ to accept the license agreement and choose the location where you wish to install the Go programming language.
- It is better to keep things simple and install it in the C drive itself. However, if you wish to install it somewhere else, you have to click on Change and choose the location.
- Finally, you have to click on ‘Install’ and click on ‘Finish’ upon completion.
How to Verify Whether Go Has Been Installed or Not?
Next, you will have to verify whether the Go was installed or not.
- You have to go ‘Start’ and type cmd
- Once the Command Prompt opens, you have to type ‘go’
- As you do so, the commands will be visible to you, and you will also get to see additional help topics.
- Now, you have to go to the C drive, and click on the Go folder
- When you do so, you will get to see api, bin, doc, lib folders, etc.
- If you click on the bin folder, you will get to see gofmt and go files.
- Just to make sure, type Environment Variables and check for the GOPATH (in my case, I have created a go-workspace folder inside Users, on the desktop)
- In the ‘System Variables’ section, you should check for the PATH.
- Click on PATH, and you will see that it is set to bin.
If you find the task to be daunting, then it is wise if you take the help of Golang development company. The experts associated with the company will help you with the installation process.
Download and Install the IDE
Now, we have to install the IDE, where we have to code. In this case, we will be choosing VS Code.
- You have to go on Google and type ‘Download VS Code’.
- Click on the search result ‘Download Visual Studio Code- Mac, Linux, Windows’
- Choose the Windows option and select ‘User Installer’ for 64-bit or 32-bit processors.
- Once it gets downloaded, we move on to the installation part.
The installation part is quite simple and straightforward.
- You have to click on ‘VSCode User Setup’ application.
- As soon as it opens, you have to accept the license agreement, and click on ‘Next’
- If you wish, you can choose to create a desktop icon.
- FInally, you click on ‘Install’, and then on ‘Finish’ once the program is installed.
With this, your VS Code will be installed on your Windows machine. And it is time to launch the application.
Again, if you feel that process is intricate, you should seek the help of a Golang development company. The professionals associated with these companies are well-versed with the paradigm and they will show you the exact process, taking very little time.
Visual Studio Code
Now that you have opened VS Code, it is time to code.
- You have to click on ‘File’. And you have to select ‘New File’.
- Since you are unfamiliar with Golang coding and syntax, you can use a sample code for the time being to test whether everything is running fine or not.
- You can copy the Go code from the official website. If you visit the link https://go.dev, and scroll down, you will get to see the ‘Try Go’ section.
- Copy the code and paste it on VS Code. You can modify the code a bit and write fmt.Println (“Hello Everyone”)
- As you try to debug, the VS Code will ask you to install certain extensions such as Go, Go Nightly, Go Test Explorer, godot-tools, and much more.
- After debugging, we now have to execute the code. But, we save the code file first under the name ‘main.go’
Go to Terminal
- Next, you have to move on to the Terminal section
- Since the ‘main.go’ file has been saved in the folder ‘go-workspace’ on the desktop, we have to type
-> cd Desktop
-> cd go-workspace
-> go run main.go
- Once you do so, the terminal will display the output ‘Hello Everyone’.
Now, you could have performed this function on the Command Prompt and the results would have been the same. But, isn’t it better to stick to the VS Code itself and get the output there only?
Well, that’s it then. In order to do Go programming, you need an IDE and compiler. And you have that at your disposal. You could have chosen other IDEs as well, like Goland, LiteIDE, etc. However, plenty of developers prefer the VS Code, so there is no harm in following the trend.
Now, you have to take the initiative of learning the Go syntax and concepts. Only then, you will be able to code. Once you get better at programming, it won’t be a hassle for you to develop REST APIs, or perform systems programming. Good Luck!