![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
github.com/asim/go-micro/cmd/protoc-gen-micro/v3
This is protobuf code generation for go-micro. We use protoc-gen-micro to reduce boilerplate code.
go install github.com/asim/go-micro/cmd/protoc-gen-micro/v3@latest
Also required:
Define your service as greeter.proto
syntax = "proto3";
service Greeter {
rpc Hello(Request) returns (Response) {}
}
message Request {
string name = 1;
}
message Response {
string msg = 1;
}
Generate the code
protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. greeter.proto
Your output result should be:
./
greeter.proto # original protobuf file
greeter.pb.go # auto-generated by protoc-gen-go
greeter.micro.go # auto-generated by protoc-gen-micro
The micro generated code includes clients and handlers which reduce boiler plate code
Register the handler with your micro server
type Greeter struct{}
func (g *Greeter) Hello(ctx context.Context, req *proto.Request, rsp *proto.Response) error {
rsp.Msg = "Hello " + req.Name
return nil
}
proto.RegisterGreeterHandler(service.Server(), &Greeter{})
Create a service client with your micro client
client := proto.NewGreeterService("greeter", service.Client())
If you see an error about protoc-gen-micro
not being found or executable, it's likely your environment may not be configured correctly. If you've already installed protoc
, protoc-gen-go
, and protoc-gen-micro
ensure you've included $GOPATH/bin
in your PATH
.
Alternative specify the Go plugin paths as arguments to the protoc
command
protoc --plugin=protoc-gen-go=$GOPATH/bin/protoc-gen-go --plugin=protoc-gen-micro=$GOPATH/bin/protoc-gen-micro --proto_path=$GOPATH/src:. --micro_out=. --go_out=. greeter.proto
Add a micro API endpoint which routes directly to an RPC method
Usage:
github.com/googleapis/googleapis
to use this feature as it requires http annotations.-I$GOPATH/src/github.com/googleapis/googleapis
for the annotations import.syntax = "proto3";
import "google/api/annotations.proto";
service Greeter {
rpc Hello(Request) returns (Response) {
option (google.api.http) = { post: "/hello"; body: "*"; };
}
}
message Request {
string name = 1;
}
message Response {
string msg = 1;
}
The proto generates a RegisterGreeterHandler
function with a api.Endpoint.
func RegisterGreeterHandler(s server.Server, hdlr GreeterHandler, opts ...server.HandlerOption) error {
type greeter interface {
Hello(ctx context.Context, in *Request, out *Response) error
}
type Greeter struct {
greeter
}
h := &greeterHandler{hdlr}
opts = append(opts, api.WithEndpoint(&api.Endpoint{
Name: "Greeter.Hello",
Path: []string{"/hello"},
Method: []string{"POST"},
Handler: "rpc",
}))
return s.Handle(s.NewHandler(&Greeter{h}, opts...))
}
protoc-gen-micro is a liberal reuse of protoc-gen-go hence we maintain the original license
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.