I just started learning golang.I have very little knowledge.
I have clicked on the link below and uploaded the package indicated by the arrow in the picture to my computer
After that
I created a folder called golang on my desktop as shown in the picture below.
I open this folder on visual studio code and i have downloaded below addition.
Finally I wrote the following code and after I ran the cod "go run main.go". But the code I wrote did not work.
Question: It came to me a little confused golang.What do i have to do to run this code what am i doing wrong?
Thanks
It's obviously not on the path. It's a bit weird as I believe Windows installer adds it properly. You can fix it though, by going to Control Panel -> System -> Advanced (Tab) -> Environment Variables. (Actual names will likely differ in your version of windows, but should be recognizably close. In worst case, search Setting environment variables for your version of windows in google.). Then find PATH variable and add path to the go executable. You'll also need to have GOROOT variable set as well.
For example, I have Go installed in C:\Go folder. So, I have GOROOT variable set as C:\Go and C:\Go\bin added to PATH variable. You can have them as either User or System variables. User ones will be visible only to you, while System ones will be for everyone. That's the only difference.
Keep in mind though that it will only affect programs started after you have updated environment variables settings. So, you'll have to restart VS Code for it to take effect.