【问题标题】:I am having problems creating my GOPATH on my mac我在 Mac 上创建 GOPATH 时遇到问题
【发布时间】:2017-03-26 03:47:08
【问题描述】:
    Andres-Air:~ iivri.andre$ echo 'export GOPATH = $HOME'>> $HOME/.profile
Andres-Air:~ iivri.andre$ source $HOME/.profile
-bash: export: `=': not a valid identifier
-bash: export: `/Users/iivri.andre': not a valid identifier
Andres-Air:~ iivri.andre$ source $HOME/.profile
-bash: export: `=': not a valid identifier
-bash: export: `/Users/iivri.andre': not a valid identifier

我正在尝试将其导出到我的环境中,但出现了这些错误。如何确保正确创建了根目录?

【问题讨论】:

  • =、变量名和值export GOPATH=$HOME >> ~/.profile之间不能有空格
  • @BigDataLearner 这次我没有包含空格,它可以工作,但是当我输入source $HOME/.profile 时,它返回了-bash: export: =' : not a valid identifier. 错误
  • 在编辑器中打开 .profile 并修复您添加的错误行。
  • @siur - JimB 是对的……你已经插入了带空格的行,你需要删除/编辑那些

标签: bash go directory


【解决方案1】:

应该是:

echo 'export GOPATH=$HOME' >> $HOME/.profile

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-08
    • 1970-01-01
    • 1970-01-01
    • 2020-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多