zoukankan      html  css  js  c++  java
  • grpc unable to determine Go import path for

    前言

    在 proto 文件夹下执行如下命令:

    $ protoc --go_out=plugins=grpc:. *.proto
    

    报错:无法确定Go导入路径

    protoc-gen-go: unable to determine Go import path for "search.proto"
    
    Please specify either:
            • a "go_package" option in the .proto source file, or
            • a "M" argument on the command line.
    
    See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more informa
    tion.
    
    --go_out: protoc-gen-go: Plugin failed with status code 1.
    
    

    解决方法

    在所有的 .proto 文件中指定路径

    option go_package ="./pb";
    

    举例:proto文件 新增第三句代码

    syntax = "proto3";
    
    package proto;
    
    option go_package ="./proto"; // 指定RPC文件生成路径地址
    
    service SearchService {
        rpc Search(SearchRequest) returns (SearchResponse) {}
    }
    
    message SearchRequest {
        string request = 1;
    }
    
    message SearchResponse {
        string response = 1;
    }
    
  • 相关阅读:
    Eclipse中项目去除Js验证
    Web安全扫描工具
    Oracle-定时任务
    About_Return
    About_php_封装函数
    About_PHP_函数
    About_PHP_验证码的生成
    About_PHP_文件的上传
    About_MySQL Select--来自copy_03
    About_AJAX_03
  • 原文地址:https://www.cnblogs.com/niuben/p/15401548.html
Copyright © 2011-2022 走看看