windows下如何玩转火热的go-zero

本文介绍了在Windows环境下如何搭建Go语言环境并使用goctl工具来玩转go-zero框架。go-zero是一个稳定的Web和RPC框架,提供一键生成多语言代码的功能。文章详细讲解了配置GO语言环境、在VSCode中设置环境、克隆go-zero项目以及解决goctl命令找不到的问题。通过体验goctl工具,可以提高开发效率,文章还提到了go-zero中的fx、mr、etcd服务发现和jwt集成等特性。
摘要由CSDN通过智能技术生成

作者:阿啄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
image

设置环境变量

环境变量path中添加 %GOROOT%\bin;%GOPATH%\bin
image

在vscode的配置

安装插件
image

关键是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,
    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值