stack-labs / questions

任何关于Micro的问题都可以在Issue中创建
27 stars 6 forks source link

用protoc新生成的文件不正确。 #23

Closed jasionLaw closed 4 years ago

jasionLaw commented 4 years ago

操作目录:

/Users/mike/Downloads/tutorials-master/examples/basic-practices/micro-api/api

执行的命令

protoc --proto_path=/Users/mike/golang/src/github.com/micro/go-micro/api/ --go_out=. --micro_out=. proto/api.proto

目录结构与教程上面一致。

生成的文件

api.pb.micro.go

api.pb.go

api.pb.micro.go的具体内容:

// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/api.proto

package go_api

import (
    fmt "fmt"
    proto "github.com/golang/protobuf/proto"
    math "math"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package

没有了registerhandle等的方法

proton等版本3.10.1

hb-chen commented 4 years ago

api.pb.micro.go只有这些内容吗? 相应的service有生成没 可以把protoc-gen-micro删了,重新安装下看看

jasionLaw commented 4 years ago

api.pb.micro.go这又这些内容吗? 相应的service有生成没 可以把protoc-gen-micro删了,重新安装下看看

重来了,还是没有生成。 在protoc-gen-micro提了issue

yes, this is newest change to have generated files names like other tools do. xx.pb.plugin.go

我的回复but, it has not func like Register*,Handler.I am so confused about this. Maybe give a doc?

hb-chen commented 4 years ago

我重新go get github.com/micro/protoc-gen-micro,生成是对的,只是文件名变了

jasionLaw commented 4 years ago

知道什么问题了。 import的路径影响到不能加载。