Skip to content

Small fixes.#684

Open
AYehia0 wants to merge 2 commits intoktr0731:masterfrom
AYehia0:small-fix
Open

Small fixes.#684
AYehia0 wants to merge 2 commits intoktr0731:masterfrom
AYehia0:small-fix

Conversation

@AYehia0
Copy link

@AYehia0 AYehia0 commented Nov 18, 2023

There are some issues with simple fixes:-

  • Printing warnings : "evans: deprecated usage, please use sub-commands. see `evans -h` for more details."
  • Panic when "ListRPCs must not return an error, but got '%s'", err", it shouldn't panic, instead just return nil.

Imagine this scenario:

- pb/
- proto/
    - user.proto
    - main_service.proto

user.proto

syntax = "proto3"; // use the latest syntax

package pb; // just to group things

import "google/protobuf/timestamp.proto";

option go_package = "github.com/AYehia0/go-bk-mst/pb";

// the main user
message User {
    // <data_type> <name> = <id>
    string username = 1;
    string email = 2;
    string full_name = 3;
    google.protobuf.Timestamp password_changed_at = 4;
    google.protobuf.Timestamp created_at = 5;
}

// create user
message CreateUserResponse {
    User user = 1;
}
message CreateUserRequest {
    string username = 1;
    string email = 2;
    string full_name = 3;
    string password = 4;
}

// login user
message LoginUserResponse {
    User user = 1;
    string access_token = 2;
    string refresh_token = 3;
    string session_id = 4;
    google.protobuf.Timestamp access_token_expires_at = 5;
    google.protobuf.Timestamp refresh_token_expires_at = 6;
}
message LoginUserRequest {
    string username = 1;
    string password = 2;
}

the main service

syntax = "proto3";

import "user.proto";

package pb;

option go_package = "github.com/AYehia0/go-bk-mst/pb";

service SimpleBank {
    rpc CreateUser (CreateUserRequest) returns (CreateUserResponse) {}
    rpc LoginUser (LoginUserRequest) returns (LoginUserResponse) {}
}

It panics : ListRPCs must not return an error, but got 'failed to resolve service pb.SimpleBank: proto: could not resolve import "user.proto": not found'

Specs

  • Os: Arch Linux
  • Terminal: Kitty
  • protoc: libprotoc 24.4
  • protoc-gen-go: protoc-gen-go v1.28.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant