美文网首页
一. go开发环境搭建

一. go开发环境搭建

作者: 茶园诗语 | 来源:发表于2019-05-31 20:05 被阅读0次

    1. 安装Go

    a. 打开网址https://golang.org/dl/

    b. 根据操作系统选择对应的安装包

    c. 点击安装包进行安装(linux直接解压)

    d. 设置环境变量(linux)

            1. exportGOROOT=$PATH:/path/to/go/ 

            2. exportPATH=$PATH:$GOROOT/bin/ 

            3. export GOPATH=/home/user/project/go

    e. 设置环境变量(window不用设置)

    2. IDE搭建(vscode) 

    a. 打开网址:https://code.visualstudio.com/ 

    b. 根据操作系统选择对应的安装包

    c. 点击安装包进行安装(linux直接解压)

    d. 选择查看-》扩展-》搜索go,安装第二个

    3. 新建项目 

    a.新建目录/home/user/project/go/src/listen1

    b.用vscode打开目录/home/user/project/go/src/listen1

    c. 右键新建文件hello.go,保存

    d. vscode会提示你安装一些go的工具,我们点击install all

    4. 调试工具delve安装

    a, 打开网址:https://github.com/derekparker/delve/tree/master/Documentation/installation

    c. linux&windows: go getgithub.com/derekparker/delve/cmd/dlv

    相关文章

      网友评论

          本文标题:一. go开发环境搭建

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