duandong1869 2018-01-20 22:50
浏览 680
已采纳

如何全局设置Go环境变量

when I declare my Go environment (namely GOPATH and GOROOT using simple export:

export GOROOT=/usr/lib/go-1.9/
export GOPATH=/my/workspace/go

the current terminal recognizes the variables normally, but if I open another terminal window, these variables are not set and they need to be reconfigured from scratch. How can I change this variables to become permanent for the system (and all future terminals)? Is there some file I need to alter or should I execute a different command?

  • 写回答

1条回答 默认 最新

  • dongmi1221 2018-01-20 23:34
    关注

    As explained here you just need to include exports export GOROOT=/usr/lib/go-1.9/ export GOPATH=/my/workspace/go at the bottom of the file ~/.profile in your home directory

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

报告相同问题?

悬赏问题

  • ¥15 寻找电脑攻防的导师,有问题请教一下。
  • ¥20 微信同是win11,我的电脑安装不了pageoffice,一直无法打开
  • ¥15 这个界面我通过postman请求不到,但是通过浏览器可以正常访问
  • ¥15 动态规划算法实现背包问题
  • ¥15 wpf程序使用过程中异常奔溃
  • ¥15 多目标优化算法在与其他算法数据对比结果判断
  • ¥15 CPTN和EAST,主干网络是VGG16,请问在ICDAR2015数据集上训练之后,CPTN和EAST模型的大小为多少
  • ¥15 按颜色进行点云分割-python
  • ¥15 Matlab如何实现汽车变道切入场景的批量仿真
  • ¥15 无刷电机要通过什么才能做各种动作