Go Dev Environments

Sagiruddin Mondal
1 min readOct 22, 2019

--

Here I am listing down some initial environment setup for Go:

Install:

Go is available in a wide range of OS types. To install the go environment, here is the marg, https://golang.org/doc/install

GOPATH:

This is a directory outside of GOROOT. It mainly contains the source for the project and their binaries. Here go keeps all external packages we use in the project as well. We can use multiple GOPATHs. This can be an accessible folder on our computer. for example,

In mac,

we can create a folder called go and export it like (in the .bash_profile):

export GOPATH={a valid folder path}
export PATH=$PATH:$GOPATH/bin

do not forget to resource the .bash_profile

In Windows:

To Run:

To initiate I am writing a very simple hello world code in visual studio code.

There are few extensions for go are available in vs code.

Package:

When you have multiple files under main, and you want to access other function from another file which shares the common package, that time, run the go files by

run go *.go

or

go build

Few reference Articles:

https://medium.com/rungo/everything-you-need-to-know-about-packages-in-go-b8bac62b74cc

--

--

Sagiruddin Mondal
Sagiruddin Mondal

Written by Sagiruddin Mondal

When my science will force you to ride a roller coaster, my art will be there to sit beside you.

No responses yet