生活处处是难题,auth.pb.gw.go编译不过

生活处处是难题,auth.pb.gw.go编译不过

老师您好,我运行genProto.sh后,只有auth.pb.gw.go没有生成

这是我的代码:

PROTO_PATH=./auth/api
GO_OUT_PATH=./auth/api/gen/v1
mkdir -p $GO_OUT_PATH

protoc -I=$PROTO_PATH --go_out=plugins=grpc,paths=source_relative:$GO_OUT_PATH auth.proto
protoc -I=$PROTO_PATH --grpc-gateway_out=paths=source_relative,grpc_api_configuration=$PROTO_PATH/auth.yaml:$GO_OUT_PATH auth.proto


PBTS_BIN_DIR=../wx/miniprogram/node_modules/.bin
PBTS_OUT_DIR=../wx/miniprogram/service/proto_gen/auth
mkdir -p $PBTS_OUT_DIR
$PBTS_BIN_DIR/pbjs -t static -w es6 $PROTO_PATH/auth.proto --no-create --no-encode --no-decode --no-verify --no-delimited --force-number -o $PBTS_OUT_DIR/auth_pb_tmp.js
echo 'import * as $protobuf from "protobufjs";\n' > $PBTS_OUT_DIR/auth_pb.js
cat $PBTS_OUT_DIR/auth_pb_tmp.js >> $PBTS_OUT_DIR/auth_pb.js
rm $PBTS_OUT_DIR/auth_pb_tmp.js
$PBTS_BIN_DIR/pbts -o $PBTS_OUT_DIR/auth_pb.d.ts $PBTS_OUT_DIR/auth_pb.js

我在终端运行后的提示是这样的:


https://img1.sycdn.imooc.com//climg/622aeb6409f0645b17481218.jpg

后面我有单独运行:

 protoc -I=./auth/api --grpc-gateway_out=paths=source_relative,grpc_api_configuration=./auth/api/auth.yaml:./auth/api/gen/v1 auth.proto

同样是这个提示:


https://img1.sycdn.imooc.com//climg/622aebaf090350f321740130.jpg

”没有匹配选择器的 HTTP 规则“

这个问题也去网上查了,无果

我记得之前弄trip.proto的时候是可以的生成trip.pb,gw.go文件的




正在回答

登陆购买课程后可参与讨论,去登陆

1回答

你单词写错了,你写的是AuthSerivce,yaml匹配的规则是AuthService

  • 慕移动9586716 提问者 #1

    哈哈,感谢大哥,就差这一个.proto文件没检查,犯低级错误了

    2022-03-12 16:05:52
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师