go环境搭建

梦想游戏人
目录:
Go

1…下载go for Windows msi  https://github.com/golang/go

2…..在vistual studio code 中搭建环境,安装go扩展

3….点击 code 右下角 analysing missing tools,会自动安装环境,GOPATH 的目录一般位于C:\Users\XXXXXX\go 下 , 安装过程中某些包可能安装失败,开VPN在尝试安装成功

4…..添加环境变量 GOPATH 为3的目录  /bin      ….  如C:\Users\XXXX\go\bin ,再把C:\Users\XXX\go\bin   C:\Users\XXX\go 添加到path 里面。

5….用户设置

{
    "workbench.startupEditor": "newUntitledFile",
    "extensions.ignoreRecommendations": true,
      "update.channel": "none",
      "files.autoSave": "onFocusChange",
    "go.buildOnSave": true,
    "go.lintOnSave": true,
    "go.vetOnSave": true,
    "go.buildTags": "",
    "go.buildFlags": [],
    "go.lintFlags": [],
    "go.vetFlags": [],
    "go.coverOnSave": false,
    "go.useCodeSnippetsOnFunctionSuggest": false,
    "go.formatOnSave": true,
    "go.formatTool": "goreturns",
    "go.goroot": "C:\\Go",
    "go.gopath": "C:\\Users\\xxxxxx\\go",
    "go.gocodeAutoBuild": true
}

F5运行

package main

import "fmt"

func main() {

	fmt.Println("Hello, Wo1111rld!")
}

一个GO语言教程 地址   http://www.yiibai.com/go/go_start.html

Scroll Up