美文网首页
go get报错

go get报错

作者: lalalasa | 来源:发表于2022-05-26 09:15 被阅读0次

    mac上直接用homebrew安装的go,在执行go get github.com/smartystreets/goconvey的时候报了以下错误

    ➜  demoProject go get github.com/smartystreets/goconvey
    package embed: unrecognized import path "embed": import path does not begin with hostname
    package io/fs: unrecognized import path "io/fs": import path does not begin with hostname
    ➜  demoProject 
    
    

    go env 检查go环境设置

    ➜  ~ go env
    // 省略
    GOPATH="/Users/xxx/go"
    // 省略
    ➜  ~
    

    问题在于我本地没有这个路径,我实际的go安装路径是/usr/local/Cellar/go@1.13

    修改GOPATH:vim .bash_profile
    加上go配置

    export GOPATH=/usr/local/Cellar/go@1.13  // 你本地的go路径
    export GOBIN=$GOPATH/bin
    export PATH=$PATH:$GOBIN
    

    使修改立即生效source .bash_profile

    Done.

    相关文章

      网友评论

          本文标题:go get报错

          本文链接:https://www.haomeiwen.com/subject/iekuprtx.html