• vscode配置go开发环境


    安装go vscode git

    设置windows用户环境变量

    GOROOT:golang安装目录
    GOPATH:存放sdk以外的第三方类库、收藏可复用的代码
    GOPATH目录约定有三个子目录:src、pkg、bin。src存放源代码(比如:.go .c .h .s等) 按照golang默认约定,go run,go install等命令的当前工作路径(即在此路径下执行上述命令);pkg编译时生成的中间文件(比如:.a)golang编译包时;bin编译后生成的可执行文件(为了方便,可以把此目录加入到PATH变量中,如果有多个gopath,那么使用{GOPATH/bin:}/bin添加所有的bin目录)

    配置go env

    # 打开git bash,键入以下命令
    go env -w GO111MODULE=on
    go env -w GOPROXY=https://goproxy.cn,direct
    

    vscode配置

    # 安装扩展:go和code runner
    # 键入ctrl+shift+p 搜:go:install/update
    # 选择所有下拉框,点击确定开始安装
    # vscode输出以下信息即完成
    Tools environment: GOPATH=D:\Dev_Go\GoPath;D:\Dev_Go\workspace
    Installing 7 tools at D:\Dev_Go\GoPath\bin;D:\Dev_Go\workspace\bin in module mode.
      gotests
      gomodifytags
      impl
      goplay
      dlv
      staticcheck
      gopls
    
    Installing github.com/cweill/gotests/gotests@latest (D:\Dev_Go\GoPath\bin\gotests.exe) SUCCEEDED
    Installing github.com/fatih/gomodifytags@latest (D:\Dev_Go\GoPath\bin\gomodifytags.exe) SUCCEEDED
    Installing github.com/josharian/impl@latest (D:\Dev_Go\GoPath\bin\impl.exe) SUCCEEDED
    Installing github.com/haya14busa/goplay/cmd/goplay@latest (D:\Dev_Go\GoPath\bin\goplay.exe) SUCCEEDED
    Installing github.com/go-delve/delve/cmd/dlv@latest (D:\Dev_Go\GoPath\bin\dlv.exe) SUCCEEDED
    Installing honnef.co/go/tools/cmd/staticcheck@latest (D:\Dev_Go\GoPath\bin\staticcheck.exe) SUCCEEDED
    Installing golang.org/x/tools/gopls@latest (D:\Dev_Go\GoPath\bin\gopls.exe) SUCCEEDED
    
    All tools successfully installed. You are ready to Go. :)
    
  • 相关阅读:
    在ts+vue中实现前端批量下载打包二维码
    常用到的MD5加密
    Permission denied Command PhaseScriptExecution failed with a nonzero exit code
    iOS App 内购 Demo
    App 上架遇到的坑
    基于StreamingKit的音频播放器
    iOS 添加多图片加签名
    xcode10 自定义代码块
    xcode10 之后代码不联想
    Mac 开发PHP 使用ThinkPHP
  • 原文地址:https://www.cnblogs.com/cpw6/p/16285537.html
Copyright © 2020-2023  润新知