

























修改完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!
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。