metaverse / truss

Truss helps you build go-kit microservices without having to worry about writing or maintaining boilerplate code.
Other
734 stars 143 forks source link

after declaration of return type to method error #270

Closed linger1216 closed 4 years ago

linger1216 commented 5 years ago

base.proto

syntax = "proto3";
package base;
option go_package = "pb";

message EmptyResponse {

}

activity_service.proto

syntax = "proto3";

package activity;

import "github.com/metaverse/truss/deftree/googlethirdparty/annotations.proto";
import "base.proto";

option go_package = "pb";

service Activity {
    rpc create (CreateActivityRequest) returns (base.EmptyResponse) {
        option (google.api.http) = {
          post: "/advertise/v1/activity"
          body: "*"
        };
    }
}

message ActivityModel {
    string id = 1;
    string name = 2;
}

message CreateActivityRequest {
    repeated ActivityModel activities = 1;
}

run: truss -v activity_service.proto --svcout ../

happen error:

DEBU[0000]                                               GOPATH="[/Users/xxx/Downloads/go_proc]"
DEBU[0000]                                               rawDefPath=activity_service.proto
DEBU[0000]                                               DefPaths="[/Users/xxx/Downloads/go_module_proc/truss-origin/cmd/truss/activity_service.proto]"
DEBU[0000]                                               PB Package=github.com/metaverse/truss/cmd/truss
DEBU[0000]                                               PB Path=/Users/xxx/Downloads/go_module_proc/truss-origin/cmd/truss
WARN[0000] No valid service is defined; exiting now.    
INFO[0000] .pb.go generation with protoc-gen-go was successful. 

I try to debug, found error in parser.go

rpc, err := ParseMethod(lex) error is: ')' after declaration of return type to method


if let base.proto message into activity.proto will be successful, plz check.

zaquestion commented 5 years ago

I'm not sure how truss plays with option go_package it's possible we make some assumptions about the package name. That said I can say for certain you'll need to be running truss with all proto files being used.

Give truss -v *.proto --svcout ../ a swing

zaquestion commented 4 years ago

@linger1216 Reopen if you've still got an issue here, closing out because inactivity