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.

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

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功