 Welcome back everyone. Today we're going to talk about how to install GoLang. Please like and subscribe for more videos and to help this channel grow. So the first thing we need to do is go to golang.org to try to get the newest version of Go. So their website actually hasn't really changed very much for quite a long time. So you'll probably see this gopher on the beginning and you can play in this playground if you want to just try go out before installing it. But we want to install today. So we will just go to this big blue button called download Go. And then you have all the compiled versions here. Usually the newest version is on top. So at the time of this video we are at Go 1.13.5. You might be on Microsoft Windows if that's the case then go ahead and download the Windows MSI file. If I just click on it I'm on Linux right now so I'll have to download the Linux version. But whenever you click on it you'll get prompted with the MSI download. Just click OK if you're on Windows and then scroll down and it tells you everything you need to know about installing it. Specifically that the GoPath or the directory that it's installed in is C drive slash Go. So it's at your root directory. You'll find C drive slash Go slash bin. And the installer should automatically put everything in your path if you just run the MSI like normal in Windows. So they also have an installer for OSX which is just a normal PKG file. What we're going to do is for Linux the pre-compiled Linux binaries and then you also have the source code that you can download and compile if you want to. So what we're going to do is download the Linux version and this is what we want. So notice this is the SHA-256 checksum so we're going to need this as well. I've already downloaded it so let's go to my downloads folder. And what I need to do now is compare the checksum to make sure that you know I got the correct file and everything's okay. It's not a signature it's just a checksum relatively easy to check. So I will go to the downloads folder and then SHA-256 sum and then the only thing in there is the Go file. So that's going to calculate the sum and 5-1-2-1 AA-569. So that's actually looking pretty good. So now we have calculated the SHA-256 sum of the installer file and I got the same hash value so it looks okay. Okay, so I know that that's alright. So now all we have to do is install it and if you go in and click on it whenever you start to download it will tell you how to install everything it gives you all the commands. So here we have tar dash capital C user local and then XZF and then the Go file the Gotar archive and what this does is unzips or untars the the binaries or the Go binaries into the folder user local. So this is going to actually install everything into user local and we're going to have to use sudo. So I've already checked this file so I know everything inside of it is actually what I want it to be. So I'm okay using sudo to install into user local. Make sure you open up the archive first and you know what's inside of it before you go running commands like this but I've already checked it before this so I'm okay doing it. Okay because we're using sudo it's going to ask for my username and password. Okay and then now it should be installed. So what I would normally need to do next is set the path. So on Linux if you don't already have installed and you haven't already set the path you need to tell your computer where the Go binary or the Go variable is. Now in Windows this path will be set for you in Linux we need to set it. So we need to edit the home.profile file and then set the path to include the Go path that we just installed to. So this is user local remember we installed everything there we installed the Go folder and in the bin folder you'll find the Go binary or the Go executable. So I will show you the profile. Let's go to just home and nano.profile. Now dot in Linux is a hidden file so in your home directory you'll have these hidden files if you look for them and then if I go and search for Go at the very bottom I've already added my path so path equals the path variable and then added onto the end user local Go bin. Now what that tells my computer to do is say okay go into this Go folder and look at all the binaries in there and run any programs that are in there or at least allow them to run just be aware that they're in there basically so that way we can run them. So once I save I'm in nano so if I do ctrl o and then enter that saves and if I do ctrl x then I can get out of it. So now all we have to do is check that Go is actually running and it's the version we expect. We expect what was it version 13.5, 1.13.5 so I just run Go version and here I should get Go version 1.13.5 and you see that that's what I get when I run Go version so if you got an error here or if nothing ran so for example if I just type taco that shouldn't be a command yeah so then it'll say no command found right if you get this type of error instead of the Go version that means that for some reason it doesn't detect the Go binary so check your path make sure that you've installed it correctly and you install it in the correct location go back and then try to reinstall it into in our case slash user slash local make sure that there is a Go folder in that directory. If Go is running but for some reason it was a different version then you might have a conflict different Go versions right in there again check what was installed and where it was installed to so just make sure whenever you type Go version you're getting the version that you expect and if it says Go version and it gives you the version and architecture then you're good to go okay all right and then that's pretty much it for installing Go now we actually have Go installed so we can do a quick test and they give you this kind of hello world Go code I'm just gonna copy and paste this directly okay so I'm going to make a file called test.go and then I'm just gonna paste everything in there and that's pretty much enough I know that package main will make a binary we'll talk about that later I'm importing a library which is the format library and then I'm using the format library to print some text which is hello world so we'll talk about what all these do later but if you just copy and paste and then control o to save and then control x to get out of it and we have our file then we can just run go build oh sorry yeah so go build is our test.go file built and then we got the test binary out here so if I do ls lha to list more details about the test binary so this test binary was created from the go code okay so this is our script that we wrote the hello world and then this is our test binary so if I want to run that test binary I just do dot slash test and there's no extension so I can just hit enter and then hello world so now we know that our code is running on windows this would basically be the same thing you could run you could create this test.go file in notepad so that's pretty much it we know that go is installed we have the newest version we have go binary location added to our path we were able to build a hello world test application and we were able to run it successfully so that's it for installing go thank you very much thanks for watching if this was helpful please like and subscribe also please consider supporting us on patreon your support lets us focus on making better tutorials for everyone