美文网首页
2021-01-04 学习GO 第一天

2021-01-04 学习GO 第一天

作者: 懂事长qingzZ | 来源:发表于2021-01-04 18:35 被阅读0次

    第一步:安装VsCode,配置环境路径 :测试go

    https://www.jianshu.com/p/67dcf4e828e9

    Mac下环境路径一个位置, 真正的工程路径是一个位置, 去.bash_profile 不显示~/.bash_profile

    使用快捷键显示隐藏文件  command + shit + .  

    第二部 在VsCode中搭建Go开发环境,手把手教你配置

    https://blog.csdn.net/adolphkevin/article/details/90274378

    不配置的话代码运行正常,会出现创建新文件夹, 一直import 报错

    第二步 在vscode安装GO插件,会出现下面的问题

    1.  go项目开发 mkdir -p $GOPATH/src/golang.org/x

    mkdir: /src/golang.org/x: Read-only file system

    解决

    Mac根目录下创建目录出现Read-only file system的问题

    https://blog.csdn.net/starry0819/article/details/102582389

    ========================================================================================================================

    2.

    macOS Catalina下安装MongoDB遇到的各种坑

    https://blog.csdn.net/weixin_45121701/article/details/104931035

    3.

    Installing github.com/mdempsky/gocode FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v github.com/mdempsky/gocode",

     "stdout": "",

     "stderr": "go get github.com/mdempsky/gocode: module github.com/mdempsky/gocode: Get \"https://proxy.golang.org/github.com/mdempsky/gocode/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v github.com/uudashr/gopkgs/v2/cmd/gopkgs",

     "stdout": "",

     "stderr": "go get github.com/uudashr/gopkgs/v2/cmd/gopkgs: module github.com/uudashr/gopkgs/v2/cmd/gopkgs: Get \"https://proxy.golang.org/github.com/uudashr/gopkgs/v2/cmd/gopkgs/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    Installing github.com/ramya-rao-a/go-outline FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v github.com/ramya-rao-a/go-outline",

     "stdout": "",

     "stderr": "go get github.com/ramya-rao-a/go-outline: module github.com/ramya-rao-a/go-outline: Get \"https://proxy.golang.org/github.com/ramya-rao-a/go-outline/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    Installing github.com/go-delve/delve/cmd/dlv FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v github.com/go-delve/delve/cmd/dlv",

     "stdout": "",

     "stderr": "go get github.com/go-delve/delve/cmd/dlv: module github.com/go-delve/delve/cmd/dlv: Get \"https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    Installing github.com/stamblerre/gocode FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v -d github.com/stamblerre/gocode",

     "stdout": "",

     "stderr": "go get github.com/stamblerre/gocode: module github.com/stamblerre/gocode: Get \"https://proxy.golang.org/github.com/stamblerre/gocode/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    Installing github.com/rogpeppe/godef FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v github.com/rogpeppe/godef",

     "stdout": "",

     "stderr": "go get github.com/rogpeppe/godef: module github.com/rogpeppe/godef: Get \"https://proxy.golang.org/github.com/rogpeppe/godef/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    Installing github.com/sqs/goreturns FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v github.com/sqs/goreturns",

     "stdout": "",

     "stderr": "go get github.com/sqs/goreturns: module github.com/sqs/goreturns: Get \"https://proxy.golang.org/github.com/sqs/goreturns/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    Installing golang.org/x/lint/golint FAILED

    {

     "killed": false,

     "code": 1,

     "signal": null,

     "cmd": "/usr/local/go/bin/go get -v golang.org/x/lint/golint",

     "stdout": "",

     "stderr": "go get golang.org/x/lint/golint: module golang.org/x/lint/golint: Get \"https://proxy.golang.org/golang.org/x/lint/golint/@v/list\": dial tcp 172.217.160.113:443: i/o timeout\n"

    }

    8 tools failed to install.

    gocode: failed to install gocode(github.com/mdempsky/gocode): Error: Command failed: /usr/local/go/bin/go get -v github.com/mdempsky/gocode

    go get github.com/mdempsky/gocode: module github.com/mdempsky/gocode: Get "https://proxy.golang.org/github.com/mdempsky/gocode/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    gopkgs: failed to install gopkgs(github.com/uudashr/gopkgs/v2/cmd/gopkgs): Error: Command failed: /usr/local/go/bin/go get -v github.com/uudashr/gopkgs/v2/cmd/gopkgs

    go get github.com/uudashr/gopkgs/v2/cmd/gopkgs: module github.com/uudashr/gopkgs/v2/cmd/gopkgs: Get "https://proxy.golang.org/github.com/uudashr/gopkgs/v2/cmd/gopkgs/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    go-outline: failed to install go-outline(github.com/ramya-rao-a/go-outline): Error: Command failed: /usr/local/go/bin/go get -v github.com/ramya-rao-a/go-outline

    go get github.com/ramya-rao-a/go-outline: module github.com/ramya-rao-a/go-outline: Get "https://proxy.golang.org/github.com/ramya-rao-a/go-outline/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    dlv: failed to install dlv(github.com/go-delve/delve/cmd/dlv): Error: Command failed: /usr/local/go/bin/go get -v github.com/go-delve/delve/cmd/dlv

    go get github.com/go-delve/delve/cmd/dlv: module github.com/go-delve/delve/cmd/dlv: Get "https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    gocode-gomod: failed to install gocode-gomod(github.com/stamblerre/gocode): Error: Command failed: /usr/local/go/bin/go get -v -d github.com/stamblerre/gocode

    go get github.com/stamblerre/gocode: module github.com/stamblerre/gocode: Get "https://proxy.golang.org/github.com/stamblerre/gocode/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    godef: failed to install godef(github.com/rogpeppe/godef): Error: Command failed: /usr/local/go/bin/go get -v github.com/rogpeppe/godef

    go get github.com/rogpeppe/godef: module github.com/rogpeppe/godef: Get "https://proxy.golang.org/github.com/rogpeppe/godef/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    goreturns: failed to install goreturns(github.com/sqs/goreturns): Error: Command failed: /usr/local/go/bin/go get -v github.com/sqs/goreturns

    go get github.com/sqs/goreturns: module github.com/sqs/goreturns: Get "https://proxy.golang.org/github.com/sqs/goreturns/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    golint: failed to install golint(golang.org/x/lint/golint): Error: Command failed: /usr/local/go/bin/go get -v golang.org/x/lint/golint

    go get golang.org/x/lint/golint: module golang.org/x/lint/golint: Get "https://proxy.golang.org/golang.org/x/lint/golint/@v/list": dial tcp 172.217.160.113:443: i/o timeout

     no output 

    解决方案:

    推荐使用:一招完美解决vscode安装go插件失败问题

    https://blog.csdn.net/sunnylucy1/article/details/109535565

    下面手动安装 有些东西我测试时不行的

    Visual Studio Code安装go插件报错解决方案

    https://blog.csdn.net/dmt742055597/article/details/85865186

    相关文章

      网友评论

          本文标题:2021-01-04 学习GO 第一天

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