https://golang.google.cn/
1、运行,安装
2、配置环境变量:
GOROOT=C:\Go\
全局PATH=%GOROOT%\bin;
GOPATH=E:\WorkSpaceGo\go
全局PATH路径 = %GOPATH%\bin
验证" go env
3.
下载GoLand, http://www.jetbrains.com/go/download/previous.html
将补丁copy至idea安装目录的bin目录下,
.在IDEA安装目录的bin目录中找到idea.exe.vmoptions和idea64.exe.vmoptions 这两个文件,用记事本打开,在文件最后追加一行内容:-javaagent:idea安装路径\bin\JetbrainsCrack-release-enc.jar,最后记得保存退出。
例如我的安装路径是:D:\Program Files\JetBrains\IntelliJ IDEA 2018.2.5
所以添加内容为:-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2018.2.5\bin\JetbrainsCrack-release-enc.jar
ThisCrackLicenseId-{
“licenseId”:”11011”,
“licenseeName”:”Wechat”,
“assigneeName”:”tree-deep-see-deer”,
“assigneeEmail”:”2378437815@qq.com”,
“licenseRestriction”:””,
“checkConcurrentUse”:false,
“products”:[
{“code”:”II”,”paidUpTo”:”2099-12-31”},
{“code”:”DM”,”paidUpTo”:”2099-12-31”},
{“code”:”AC”,”paidUpTo”:”2099-12-31”},
{“code”:”RS0”,”paidUpTo”:”2099-12-31”},
{“code”:”WS”,”paidUpTo”:”2099-12-31”},
{“code”:”DPN”,”paidUpTo”:”2099-12-31”},
{“code”:”RC”,”paidUpTo”:”2099-12-31”},
{“code”:”PS”,”paidUpTo”:”2099-12-31”},
{“code”:”DC”,”paidUpTo”:”2099-12-31”},
{“code”:”RM”,”paidUpTo”:”2099-12-31”},
{“code”:”CL”,”paidUpTo”:”2099-12-31”},
{“code”:”PC”,”paidUpTo”:”2099-12-31”}
],
“hash”:”2911276/0”,
“gracePeriodDays”:7,
“autoProlongated”:false}
4. 安装VS进行编辑
安装go插件, 安装git工具; 最后由于某种原因你无法下载需要的包, 这时:
在E:\WorkSpaceGo\go\src 目录下:
创建目录
E:\WorkSpaceGo\go\src\github.com\golang
E:\WorkSpaceGo\go\src\golang.org\x
在x目录下, git clone https://github.com/golang/tools.git tools , 然后将tools目录复制到golang下面;
重启VS, 再次安装;
package main
import "fmt"
func main() {
fmt.Println("Hello world")
}
增加代码提示功能:
在settings.json文件中添加:
{ "go.autocompleteUnimportedPackages": true, "go.gocodePackageLookupMode": "go", "go.gotoSymbol.includeImports": true, "go.useCodeSnippetsOnFunctionSuggest": true, "go.inferGopath": true, "go.gopath": "C:/Users/Administrator/go", "go.useCodeSnippetsOnFunctionSuggestWithoutType": true, }
安装后 GOPATH\bin 目录下会自动生成 govendor.exe