anz-bank / sysl-go

Communication library used by SYSL-generated code written in Go.
Apache License 2.0
10 stars 14 forks source link

GRPC clients are incorrect #203

Closed joshcarp closed 4 years ago

joshcarp commented 4 years ago

In the repo here There are a lot of incorrect lines, so here's a diff of actual vs expected

// Code generated by sysl DO NOT EDIT.
package depserver

import (
    "context"
    "time"

-       pb "api.proto"
+   pb "github.com/joshcarp/plz-stop-the-sysl/api/plzserver"

    "google.golang.org/grpc"
)

// Client implements a client for myserverdep.
type Client struct {
-   client pb.myserverdepClient
+   client pb.MyserverClient
    addr   string
}

// NewClient creates a new Client.
func NewClient(addr string, connTimeout time.Duration) (*Client, error) {
    ctxWithTimeout, cancel := context.WithTimeout(context.Background(), connTimeout)
    defer cancel()

    conn, err := grpc.DialContext(ctxWithTimeout, addr, grpc.WithBlock())
    if err != nil {
        return nil, err
    }

-   return &Client{pb.NewmyserverdepClient(conn), addr}, nil
+        return &Client{pb.NewMyserverClient(conn), addr}, nil
}

// Hello ...
func (s *Client) Hello(ctx context.Context, input *pb.HelloRequest) (*pb.HelloResponse, error) {
    return s.client.Hello(ctx, input)
}
nydrani commented 4 years ago

Fixed with https://github.com/anz-bank/sysl-go/commit/7b3ce5ee7e8e5fb584fc8952fb2a21b1b92765fc