Evans CLI - A Go gRPC Client

Last Update : 21 December, 2023 | Published : 01 June, 2023 | 3 Min Read
alter-text

Evans CLI is a command-line tool designed to facilitate interaction with Go gRPC services. It offers a range of features that simplify the testing and debugging of gRPC services. Here are some of the advantages of using Evans CLI:

Advantages of Evans CLI

Evans CLI stands out from other tools for interacting with gRPC services due to the following advantages:

  • Ease of use: Evans CLI provides a simple command-line interface, making it incredibly user-friendly. It allows you to effortlessly send requests and receive responses from gRPC services.

  • Powerful features: Evans CLI boasts several powerful features that streamline the testing and debugging process. These features include automatic service discovery, an interactive mode, and code generation capabilities.

  • Open source: Evans CLI is an open-source tool, which means it is free to use and modify. This makes it a flexible and cost-effective choice for developers.

Installation of Evans CLI

To install Evans CLI, follow these steps:

Sample gRPC Server Project

For the purpose of demonstrating the usage of Evans CLI, let’s consider a sample gRPC server that implements CRUD (Create, Read, Update, Delete) operations based on an office protocol file.

You can find the source code for this sample project here.

How Evans CLI Solves Client-Side Issues for the gRPC Server

Evans CLI addresses client-side issues for the gRPC server through its REPL (Read-Eval-Print Loop) mode and CLI (Command Line Interface) mode. In this example, we will focus on the REPL mode, as it offers a more user-friendly way to interact with the server.

To start the Evans CLI client in REPL mode, execute the following command in the root directory of your project:

evans -r repl -p <your-gRPC-server-port>

Evans CLI REPL Mode

Here are some useful commands you can utilize with Evans CLI:

  • To view the available packages on your server, use the command:
show package

View Packages

  • To select a specific package from the available options, use the command:
package <Package_Name>

For example:

package gen

Select Package

  • To view the services within the selected package, use the command:
show service

View Services

  • To select a specific service from the available options, use the command:
service <Service_Name>

For example:

service OfficeService

Select Service

  • To view the messages within the services.package, use the command:
show message

View Messages

  • To obtain more information about a particular message and its fields, use the command:
desc <Message_Name>

For example:

desc Office

Message Description

  • To view the RPC methods

available in the services, use the command:

show rpc

View RPC Methods

  • To call a method from a service, use the command:
call <rpc-method-name>

For example:

call CreateOffice

Call Method Check RPC

Conclusion

Evans CLI is a powerful tool that simplifies the testing and debugging of Go gRPC services. With its easy-to-use interface, rich set of features, and open-source nature, Evans CLI provides developers with an efficient way to interact with gRPC servers.

By installing Evans CLI and utilizing its REPL mode, developers can seamlessly explore, inspect, and test the different APIs exposed by their gRPC servers. This interactive approach enhances the development workflow, improves efficiency, and boosts confidence in the reliability of gRPC-based systems.

Embrace Evans CLI as your go-to tool for testing and debugging Go gRPC services, and experience the benefits of its simplicity, power, and open-source nature. Happy coding!

Related posts

Looking for Cloud-Native Implementation?

Finding the right talent is pain. More so, keeping up with concepts, culture, technology and tools. We all have been there. Our AI-based automated solutions helps eliminate these issues, making your teams lives easy.

Contact Us