WEBVTT 00:00.360 --> 00:01.190 Hello. 00:01.290 --> 00:03.930 Welcome to the first section of this video of course. 00:03.930 --> 00:06.390 Ready steady go. 00:06.390 --> 00:12.000 In this section we will first install go on our machine and then start with a simple program to display 00:12.210 --> 00:15.780 hello world as we usually do in other languages. 00:15.780 --> 00:21.540 Then we will learn about flow controls functions arrays slices and maps. 00:21.540 --> 00:26.060 Then we will move on to explore about pointers structures and interfaces. 00:26.070 --> 00:30.060 We will also dive into testing and TDD in go. 00:30.060 --> 00:35.260 We will end this section with go libraries and go get tools. 00:35.280 --> 00:40.690 Now we move on to the first video of the section that deals with installing go. 00:40.830 --> 00:47.380 In this video we learn how to install go on different operating systems like Linux Windows etc.. 00:47.520 --> 00:52.470 Also we will see how to set the workplace any go installation needs. 00:52.470 --> 01:00.710 Two basic things the binaries of the language somewhere on your desk and a go path in your system where 01:00.730 --> 01:05.060 the projects and the projects that you download from other people will be stored. 01:05.110 --> 01:12.700 Let's explore how to install go binaries in Linux Windows and the ASX for a detailed explanation of 01:12.700 --> 01:15.360 how to install the latest version of Go. 01:15.370 --> 01:21.750 You can refer to the official documentation at go lying dot org which you see on your screen. 01:22.150 --> 01:25.290 Now to install go in Linux you have two options. 01:25.330 --> 01:30.220 The easy option is to use your distribution package manager that is fedora centers. 01:30.220 --> 01:40.360 Users can use this command sudo why you m install hyphen y go Lang for a burn 2 or Debian users using 01:40.450 --> 01:50.490 a P T could use this command at the terminal sudo apt hyphen get install hyphen y go lying next. 01:50.620 --> 01:56.710 The advanced option includes downloading the latest distribution from go line dot org website which 01:56.710 --> 01:58.270 you see on your screen. 01:58.480 --> 02:04.480 I recommend using the second option that is the advanced option and downloading a distribution goes 02:04.570 --> 02:09.970 updates maintains backward compatibility and you usually should not be worried about updating your go 02:09.970 --> 02:11.990 binaries frequently. 02:11.990 --> 02:18.610 Let's start with go Linus advanced installation the advanced installation of go in Linux requires you 02:18.610 --> 02:26.130 to download the binaries from go lying web page after entering H TTP s go Lang dot org. 02:26.200 --> 02:30.580 Click the download go button which you'll usually find on the right. 02:30.580 --> 02:37.140 Some feature downloads option is available for each distribution so let's download for Linux. 02:37.210 --> 02:42.620 Select Linus distribution to download the latest stable version at the same web link. 02:42.640 --> 02:47.660 You can also download beta versions of the language go it's done. 02:48.040 --> 02:55.120 Since we have saved the tar dot GZ file in downloads folder so let's extract it and move it to a different 02:55.120 --> 02:57.070 path by convention. 02:57.190 --> 03:05.350 Go binaries are usually placed in user slash local slash go directory first moved to the directory which 03:05.350 --> 03:06.950 I mentioned previously. 03:06.970 --> 03:17.560 Let's move to the downloads directory and then type tar hyphen z x v f go one point eight point line 03:17.560 --> 03:22.780 X hyphen a M.D. 64 dot tar dot GZ 03:25.370 --> 03:29.220 as you can see all the necessary packages have been installed. 03:29.250 --> 03:32.120 Also we've extracted all the files. 03:32.150 --> 03:38.960 Now let's execute the command to move it to the user slash local slash go path. 03:38.960 --> 03:43.910 Now we have our go installation in the user slash locals slash go path. 03:43.940 --> 03:50.600 So now we have to add the bins sub folder to our path and the bin folder within our go path. 03:51.020 --> 03:52.970 Let us create a directory. 03:52.970 --> 03:56.960 Use the make directory command with hyphen P.. 03:57.020 --> 04:00.450 We are telling bash to create all directories that are unnecessary. 04:00.470 --> 04:07.090 Now we need to append to bin folder paths to our path append these lines at the end of your dot. 04:07.110 --> 04:11.300 BASH R C let's open bash or c file. 04:11.660 --> 04:13.710 Here's the DOT bash our c file. 04:13.880 --> 04:17.250 Let's add a line of code for the path at the end of the file. 04:17.300 --> 04:20.150 Now save it now. 04:20.180 --> 04:20.780 Check it out. 04:20.780 --> 04:22.940 Go bin directory is available. 04:22.940 --> 04:24.400 Execute the command. 04:24.500 --> 04:33.190 Go space version so you can see that the go version one point eight point line X is now ready. 04:33.190 --> 04:36.670 Superb to install go in windows. 04:36.730 --> 04:39.030 You will need administrative privileges. 04:39.040 --> 04:46.750 Open your favorite browser and navigate to each TTP as colon forward slash forward slash go line dot 04:46.870 --> 04:47.760 org. 04:47.800 --> 04:53.110 Once there click the download go button and select Microsoft Windows distribution. 04:53.110 --> 04:56.790 That is not a Messi file as you click on this link. 04:56.830 --> 05:03.460 An asterisk dot MSA file will start downloading it takes some time okay. 05:03.460 --> 05:09.310 Execute the Amazon installer by double clicking it an installer will appear asking you to accept the 05:09.310 --> 05:15.130 end user license agreement click on Next and select a target folder for your installation. 05:15.160 --> 05:23.040 We will continue with the default path that in my case is C colon backslash yo and now click on install. 05:23.120 --> 05:25.270 Let us wait for the installation to complete. 05:25.360 --> 05:27.730 Finally click on the finished button. 05:27.940 --> 05:34.540 Once the installation is finished you will have to add the binary go folder located in C colon go in 05:34.600 --> 05:35.870 to your path. 05:35.950 --> 05:40.150 For this you must go to Control Panel and select system options. 05:40.150 --> 05:46.020 Once in system select the advanced tab and click the environment variables button. 05:46.120 --> 05:52.300 Here you'll find a window with variables for your current user and system variables in System variables. 05:52.300 --> 05:54.430 You'll find the path variable. 05:54.430 --> 05:58.510 Click it and click the edit button to open a text box. 05:58.510 --> 06:05.620 You can add your path by adding semicolon C colon backslash go forward slash pin at the end of the current 06:05.620 --> 06:06.410 line. 06:06.460 --> 06:12.210 Note the semicolon at the beginning of the path in recent Windows versions like Windows 10. 06:12.280 --> 06:15.320 You will have a manager to add variables easily. 06:15.340 --> 06:21.340 Now let's set the workplace so go will always work under the same workspace. 06:21.340 --> 06:27.280 This helps the compiler to find packages and libraries that you could be using this workspace is commonly 06:27.280 --> 06:35.400 called Go path go path as a very important role in your working environment while developing go software. 06:35.500 --> 06:41.530 When you import a library in your code it will search for this library in your go path slash source 06:41.980 --> 06:48.970 the same when you install some go apps binaries will be stored and go path slash bin folder. 06:48.970 --> 06:55.180 At the same time all your source code must be stored in a valid route within go path slashed source 06:55.180 --> 06:55.950 folder. 06:55.990 --> 07:00.710 For example I stole my projects in get hub and my username is Satan. 07:00.730 --> 07:09.730 So for a project called minimal m e S O S go framework I will have this folder structure like go past 07:09.940 --> 07:18.310 slash source get hub dot com slash Satan slash minimal mesas go framework which reflects the U R L where 07:18.310 --> 07:25.780 this repository is stored at get hub as you can see here at the terminal let execute the command make 07:25.780 --> 07:35.140 directory hyphen P home slash go now the home go path is going to be the destination of our go path 07:35.650 --> 07:41.500 we have to set an environment variable within our go path pointing to this folder just set the environment 07:41.500 --> 07:49.240 variable open again the file home slash dot bash R see with your favorite text editor and add this line 07:49.360 --> 07:53.290 at the end of it save the file and close it. 07:53.290 --> 07:56.830 Now open a new terminal to check that everything is working. 07:56.920 --> 08:00.850 Just write an echo to the GO PAST variable like this. 08:00.900 --> 08:07.450 Go if the output of the preceding command points to your chosen go path everything is correct and you 08:07.450 --> 08:14.320 can continue to write your first program in this video we saw how to install go on our machine and set 08:14.320 --> 08:21.430 our workplace in the next video we will learn to write a simple programming go to display hello world.