Hello.
Welcome to the first section of this video of course.
Ready steady go.
In this section we will first install go on our machine and then start with a simple program to display
hello world as we usually do in other languages.
Then we will learn about flow controls functions arrays slices and maps.
Then we will move on to explore about pointers structures and interfaces.
We will also dive into testing and TDD in go.
We will end this section with go libraries and go get tools.
Now we move on to the first video of the section that deals with installing go.
In this video we learn how to install go on different operating systems like Linux Windows etc..
Also we will see how to set the workplace any go installation needs.
Two basic things the binaries of the language somewhere on your desk and a go path in your system where
the projects and the projects that you download from other people will be stored.
Let's explore how to install go binaries in Linux Windows and the ASX for a detailed explanation of
how to install the latest version of Go.
You can refer to the official documentation at go lying dot org which you see on your screen.
Now to install go in Linux you have two options.
The easy option is to use your distribution package manager that is fedora centers.
Users can use this command sudo why you m install hyphen y go Lang for a burn 2 or Debian users using
a P T could use this command at the terminal sudo apt hyphen get install hyphen y go lying next.
The advanced option includes downloading the latest distribution from go line dot org website which
you see on your screen.
I recommend using the second option that is the advanced option and downloading a distribution goes
updates maintains backward compatibility and you usually should not be worried about updating your go
binaries frequently.
Let's start with go Linus advanced installation the advanced installation of go in Linux requires you
to download the binaries from go lying web page after entering H TTP s go Lang dot org.
Click the download go button which you'll usually find on the right.
Some feature downloads option is available for each distribution so let's download for Linux.
Select Linus distribution to download the latest stable version at the same web link.
You can also download beta versions of the language go it's done.
Since we have saved the tar dot GZ file in downloads folder so let's extract it and move it to a different
path by convention.
Go binaries are usually placed in user slash local slash go directory first moved to the directory which
I mentioned previously.
Let's move to the downloads directory and then type tar hyphen z x v f go one point eight point line
X hyphen a M.D. 64 dot tar dot GZ
as you can see all the necessary packages have been installed.
Also we've extracted all the files.
Now let's execute the command to move it to the user slash local slash go path.
Now we have our go installation in the user slash locals slash go path.
So now we have to add the bins sub folder to our path and the bin folder within our go path.
Let us create a directory.
Use the make directory command with hyphen P..
We are telling bash to create all directories that are unnecessary.
Now we need to append to bin folder paths to our path append these lines at the end of your dot.
BASH R C let's open bash or c file.
Here's the DOT bash our c file.
Let's add a line of code for the path at the end of the file.
Now save it now.
Check it out.
Go bin directory is available.
Execute the command.
Go space version so you can see that the go version one point eight point line X is now ready.
Superb to install go in windows.
You will need administrative privileges.
Open your favorite browser and navigate to each TTP as colon forward slash forward slash go line dot
org.
Once there click the download go button and select Microsoft Windows distribution.
That is not a Messi file as you click on this link.
An asterisk dot MSA file will start downloading it takes some time okay.
Execute the Amazon installer by double clicking it an installer will appear asking you to accept the
end user license agreement click on Next and select a target folder for your installation.
We will continue with the default path that in my case is C colon backslash yo and now click on install.
Let us wait for the installation to complete.
Finally click on the finished button.
Once the installation is finished you will have to add the binary go folder located in C colon go in
to your path.
For this you must go to Control Panel and select system options.
Once in system select the advanced tab and click the environment variables button.
Here you'll find a window with variables for your current user and system variables in System variables.
You'll find the path variable.
Click it and click the edit button to open a text box.
You can add your path by adding semicolon C colon backslash go forward slash pin at the end of the current
line.
Note the semicolon at the beginning of the path in recent Windows versions like Windows 10.
You will have a manager to add variables easily.
Now let's set the workplace so go will always work under the same workspace.
This helps the compiler to find packages and libraries that you could be using this workspace is commonly
called Go path go path as a very important role in your working environment while developing go software.
When you import a library in your code it will search for this library in your go path slash source
the same when you install some go apps binaries will be stored and go path slash bin folder.
At the same time all your source code must be stored in a valid route within go path slashed source
folder.
For example I stole my projects in get hub and my username is Satan.
So for a project called minimal m e S O S go framework I will have this folder structure like go past
slash source get hub dot com slash Satan slash minimal mesas go framework which reflects the U R L where
this repository is stored at get hub as you can see here at the terminal let execute the command make
directory hyphen P home slash go now the home go path is going to be the destination of our go path
we have to set an environment variable within our go path pointing to this folder just set the environment
variable open again the file home slash dot bash R see with your favorite text editor and add this line
at the end of it save the file and close it.
Now open a new terminal to check that everything is working.
Just write an echo to the GO PAST variable like this.
Go if the output of the preceding command points to your chosen go path everything is correct and you
can continue to write your first program in this video we saw how to install go on our machine and set
our workplace in the next video we will learn to write a simple programming go to display hello world.