惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

博客园 - 雨V幕

使用chromedp 来做人工模拟操作爬取数据方法 遍历redis按照前缀给未设置过期时间的数据添加过期时间 使用rabbitmq 进行任务调度 使用trace进行排查网络瓶颈 使用vscode 调试 Python 使用power shell 拆分 csv文件 将大文件拆分成小文件。 使用postman 添加预处理验签。 go 使用pprof 进行问题排查 Mysql无主键删除重复数据的快速方法 解决mysql 事务死锁的方法 go在处理批量下载时候出现fatal error: runtime: out of memory AnalyticDB 创建db go 序列化反序列化之后时区信息丢失 clickhouse 进行建表期间的一些优化 Sql Server使用函数获取拼音码 关于async 和await关键字 使用kubespray 一键部署 containerd 的安装和熟悉 VMware 配置双网卡实现上网和固定ip
kraots2.0 在windows 环境搭建开发环境
雨V幕 · 2024-02-01 · via 博客园 - 雨V幕
  • 首先需要准备的东西
    • go 
    • protoc 直接去这里下 https://github.com/protocolbuffers/protobuf/releases 然后把exe 文件放置到go Path目录
    • protoc-gen-go 直接通过go install 命令进行安装
    • 使用Chocolatey 安装make
  •  安装 kratos 命令工具
    •  go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
    • 这里会有一些奇葩的path 问题。但是我们不需要关注,如果install命令执行没有问题既可以使用everyThing 这个软件加上.exe后缀 查找到build之后的exe文件。把它放置到go Path目录让系统可以识别命令即可。
    • 还有很多问题都是环境变量导致的。 使用  Get-Command 命令查看当前命令执行的是哪个目录的exe 
  • 使用kratos new 命令创建项目
  • 使用make 在windows环境进行build项目 
    • 这里核心的一个问题是官方提供的makefile 文件中 使用的是gitbash 的find.exe 来替代windos环境的find命令。 
    • 容易出现文件夹带空格等一系列问题。 我的解决方案是把git find.exe 在系统中的环境变量优先于 /system32 中的find.exe 这样就不用担心find 命令 windows和liunx的差异问题了
    •  修改完find的默认执行方式之后就不存在系统的差异了下面这段make 脚本可以直接修改成为 :

      ifeq ($(GOHOSTOS), windows)
          #the `find.exe` is different from `find` in bash/shell.
          #to see https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/find.
          #changed to use git-bash.exe to run find cli or other cli friendly, caused of every developer has a Git.
          #Git_Bash= $(subst cmd\,bin\bash.exe,$(dir $(shell where git)))
          Git_Bash=$(subst \,/,$(subst cmd\,bin\bash.exe,$(dir $(shell where git))))
          INTERNAL_PROTO_FILES=$(shell $(Git_Bash) -c "find internal -name *.proto")
          API_PROTO_FILES=$(shell $(Git_Bash) -c "find api -name *.proto")
      else
          INTERNAL_PROTO_FILES=$(shell find internal -name *.proto)
          API_PROTO_FILES=$(shell find api -name *.proto)
      endif
      
      可以直接修改成为以下内容
          INTERNAL_PROTO_FILES=$(shell find internal -name *.proto)
          API_PROTO_FILES=$(shell find api -name *.proto)

       在 make generate 的时候可能会出现问题 可能是go env 的设置问题。 如果是windows环境配置的是liunx 的时候寻找包的目录可能会有问题。

       go env -w GOOS=windows
    • 如果要打Linux 的包的话使用以下命令, 但是在generate 的步骤GOOS 配置最好和本机系统保持一致
      go env -w GOOS=windows 进行go build 即可
    • 使用wire尽量不要编辑wire_gen.go文件这个文件尽量使用命令来修改, 我们应该修改的是wire.go 这个文件。

      最后执行make all 进行项目代码生成 ,途中如果报找不到protc命令 使用go install 安装对应的命令即可。 

stay hungry stay foolish!

posted @ 2024-02-01 17:31  雨V幕  阅读(502)  评论()    收藏  举报