关于golang:windows安装golang

5次阅读

共计 422 个字符,预计需要花费 2 分钟才能阅读完成。

  1. golang 下载链接:
    https://go.dev/dl/
  2. 配置环境变量
    在零碎环境变量外面加上下载的 go 目录
    eg:C:\Program Files\Go\bin
    $ go version 查看装置的版本
  3. 配置 go 环境 举荐用 PowerShell 关上 cmd
    $go env 查看 go 的环境变量
    $go env -w GO111MODULE=on 设置 go module 治理我的项目
    $go env -w GOPROXY=https://goproxy.cn,direct 设置代理
    goroot 为 go 装置的门路
    gopath 为 go 我的项目所在的门路(高版本不在依赖 gopath 来治理包)
  4. 装置 git 不便在 github 上下载包
    https://git-scm.com/downloads
    $git version 查看装置的版本
    将 git 目录的 bin 文件增加到零碎环境变量
  5. Idea 举荐

    • vscode 须要 code runner 插件和 go 插件
    • goland 须要插件generate struct tags for golang
正文完
 0