作者:阿啄debugIT
前言
go-zero 是一个集成了各种工程实践的 web 和 rpc 框架。通过弹性设计保障了大并发服务端的稳定性,经受了充分的实战检验。
go-zero 包含极简的 API 定义和生成工具 goctl,可以根据定义的 api 文件一键生成 Go, iOS, Android,
Kotlin, Dart, TypeScript, JavaScript 代码,并可直接运行。
这么牛,怎么不想去试一下?!
go语言环境搭建
配置GO语言环境
新增go的代理
GOPROXY=https://goproxy.io,direct,https://mirrors.aliyun.com/goproxy/,https://goproxy.cn,https://athens.azurefd.net,https://gonexus.dev
设置环境变量
环境变量path中添加 %GOROOT%\bin;%GOPATH%\bin
在vscode的配置
安装插件
关键是go语言环境在vscode的配置,如下:
{
"go.goroot": "D:\\go",
"go.gopath": "D:\\go_project",
"go.inferGopath": false,
"go.toolsGopath": "D:\\go_project",
"window.zoomLevel": 0,
"git.autofetch": true,
"terminal.integrated.shell.windows": "powershell.exe", // 也可以使用 cmd.exe
"workbench.colorTheme": "Monokai Pro (Filter Machine)",
"workbench.iconTheme": "Monokai Pro (Filter Machine) Icons",
"editor.renderControlCharacters": false,
"editor.snippetSuggestions": "top",
"editor.suggest.snippetsPreventQuickSuggestions": true,
"breadcrumbs.enabled": true,
"terminal.explorerKind": "external",
"editor.cursorStyle": "block",
"editor.links": false,
"editor.mouseWheelZoom": true,
"editor.renderLineHighlight": "all",
"editor.suggest.shareSuggestSelections": true,
"outline.icons": true,
"search.showLineNumbers": true,
"search.smartCase": true,
// package 查找模式
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeGoroot": true,
"go.gotoSymbol.includeImports": true,
// build 相关
"go.buildOnSave": "off",
"go.gocodeAutoBuild": true,
"go.installDependenciesWhenBuilding": true,
"go.buildFlags": [],
"go.buildTags": "",
"go.coverOnSingleTest": true,
"go.useCodeSnippetsOnFunctionSuggest": true,