dtpngq3378499 2015-08-07 01:59
浏览 22
已采纳

鱼壳中有多个GOPATH

I'm using fish shell. config.fish has GOPATH environment as:

set -x GOPATH $HOME/Documents/Programming/go/3rdparty:$HOME/Documents/Programming/go/own

I have two problems.

1st: Can't call executables in 3rdparty/bin directly such as golocc or godep. I must go in the directory and call it as ./godep and so on. How can I make godep to be called globally.

2nd: I can't cd to $GOPATH. cd $GOPATH gives

cd: The directory '/Users/xxx/Documents/Programming/go/3rdparty:/Users/xxx/Documents/Programming/go/own' does not exist

I'm guessing both problems occurs because of my GOPATH. What is the problem?

  • 写回答

1条回答 默认 最新

  • dongzhi1904 2015-08-07 03:16
    关注

    GOPATH is only relevant to the Go toolkit, you have to set the PATH variable.

    Since you have more than 1 folder in your GOPATH you will have to do it like this:

    set -gx PATH $PATH $HOME/Documents/Programming/go/3rdparty
    set -gx PATH $PATH $HOME/Documents/Programming/go/own
    

    For the second problem, you simply can't do that, on solution is to have multiple variables for example:

    set -gx GOPATH1 $HOME/Documents/Programming/go/3rdparty
    set -gx GOPATH2 $HOME/Documents/Programming/go/own
    set -gx GOPATH $GOPATH1:$GOPATH2
    set -gx PATH $PATH $GOPATH1/bin
    set -gx PATH $PATH $GOPATH2/bin
    

    Then you will be able to cd $GOPATH1 or $GOPATH2

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

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号