How to Install Go and dependencies on Windows

How to Install Go and dependencies on Windows?'s picture

So, you have finally decided to learn Golang for back-end development and system programming? You have taken the right step. Well, this is not me saying this (my opinions don’t matter in this regard). That’s what the market is saying, as most developers are leaning towards Golang these days. The language is easy to learn, and once you learn the basics, you will find the coding to be interesting.

Now, you would have to install Go first, right? So, let us get started!

What Do You Have to Type?

  • Type ‘Golang.org’
    First, you have to type ‘Golang.org’ on your browser. Then, you should click on the search result ‘The Go Programming Language’. Once the page loads, you have to click on Downloads. Now, you will see an array of download options for Microsoft Windows, Apple macOS, Linux and Source. You have to choose Microsoft Windows and download the version go1.18.4.windows-amd64.msi. It will automatically start downloading.
Featured download
(Source: Downloads - The Go Programming Language)

What to do After it Gets Downloaded?

  • Just a Test
    If you open the Command Prompt, and type ‘go’, you will be displayed
    “ ‘go’ is not recognized as an internal or external command, operable program or batch file” This is because Golang has not been installed on your system. So, there is no question of specified path or directory.
  • Open the Installer
    Now, you have to open the installer. Click on ‘Next’ and make sure that you have the destination folder correctly set (preferably in the C drive). This is crucial, otherwise Golang won’t be able to debug or execute any program. Once it gets installed, go back to the Command Prompt and type ‘go’. You will get to see a list of commands.

Do We Need to Download Any Other Applications?

Yes, next you have to download the Git installer.

  • Visit git-scm.com and click on the section labeled ‘Downloads.’
  • You have to choose the platform, which is Windows in this case.
  • Download will start automatically

Launch the .exe file
Once you open the file, you should click on ‘Next’ in all the windows. Keep on clicking on ‘Next’, until you reach ‘Install’. You should click on it to finish the process.

What’s Left to Do?

Now, you have to perform certain modifications on your system to ensure the smooth execution of Golang programs.

  • Search for ‘env’ on Windows Search Bar
    As you type env in the Search bar, you get ‘Edit the System Environment Variables’. Click on it. Then click on ‘Environment Variables’. Your first task would be to ensure the PATH. Usually it should be C:\Go\bin. All the packages and files are stored here.
  • Change GOPATH
    For this, you have to open File Explorer and click on Desktop. Here, we create a folder called ‘go-workspace’. This is the folder where you will have all the projects and models stored. Next, you click on GOPATH on ‘Environment Variables’ (as mentioned before). You have to click on Browse Directory and select Desktop followed by ‘go-workspace’. Finally, you click on OK.
Change GOPATH

Now, if you type ‘go env’ on Command Prompt, it will show you all the variables.

What’s Next?

Open Command Prompt and type:

->cd Desktop
->cd go-workspace
->mkdir restapi
->cd restapi

Now, this will create a folder inside your ‘go-workspace’ folder called ‘restapi’.

  • Now, you have to open VS Code (the most popular IDE and text editor), and write a sample program to make sure that everything is working fine. You have to select the ‘restapi’ folder inside ‘go-workspace’ and create a file called ‘main.go’.
  • Pay heed to the recommendations and install the extensions. These are essentially different tools and packages for the Golang language. And it makes the coding experience smoother.
    Once, the file has been created, type:
go-workspace’ folder called ‘restapi


As you can see, if you then run the program in the terminal, you will be displayed “Hello Soham”

So, your installation is successful. Now, we move on to the installation of Golang Project dependencies.

Installing Go Project Dependencies

When we install the Go project dependencies, we have to take advantage of the ‘go get’ command. This helps in automatic updation of the go.mod file. Now that you have the workspace ready, you have to install the packages.

A Little Information on Modules

Modules refer to a collection of Go packages. It is stored in the file tree structure, with the go.mod file at the root of the tree. The go.mod file allows you to define the module path and dependency requirements.

Now, back to the installation process. For instance, let us install the glog package from github.com. For that we have to type:

->go get github.com/golang/glog

Similarly, you can install any other packages in this way.

If you follow the steps mentioned above, then you will face no issues when you install Golang on your system. However, you do have to make sure that you define the GOPATH clearly and specify the directory when you execute the program. Happy coding!

Soham Mukherjee's picture
Soham Mukherjee

I have been working as a content writer for four years, after I graduated in 2018 with a B.Tech in Electronics and Telecommunication. Learning about programming languages and technologies is a passion for me. Apart from programming, I like to play guitar in my leisure time.

Related Blogs

How to Become a Golang Developer?

There is a big difference between knowing a language and becoming a developer. If you wish to become a Golang developer

What is the difference between Go run, Go build and Go install commands?

Go is a statically typed, compiled programming language designed by Robert Griesemer, Rob Pike, and Ken Thompson.

Top 7 Reasons Using Golang for Mobile App Development

Golang has been predominantly used as a language for backend development, systems programming and for designing web applications.

Share this Article

Page Content

What Do You Have to Type?

What to do After it Gets Downloaded?

Do We Need to Download Any Other Applications?

What’s Left to Do?

What’s Next?

Open Command Prompt and type:

Installing Go Project Dependencies

A Little Information on Modules