dongzhijing8202 2017-08-03 10:04
浏览 41
已采纳

Golang命令不起作用

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

https://golang.org/dl/

enter image description here

After that

I created a folder called golang on my desktop as shown in the picture below.

enter image description here

I open this folder on visual studio code and i have downloaded below addition.

enter image description here

Finally I wrote the following code and after I ran the cod "go run main.go". But the code I wrote did not work.

enter image description here

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

  • 写回答

1条回答 默认 最新

  • dry18813 2017-08-03 10:33
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?