You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

github.com/gogo/status

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/gogo/status


Version published
Created

Readme

Source

Status

This is a convenience package for users of gogo/protobuf to be able to use their gogo/protobuf generated message easily and transparently with the gRPC status error structure.

It requires Go gRPC version 1.11 or above to successfully transmit statuses over the gRPC transport.

Use

Use as you would the normal grpc/status package:

return status.Error(codes.NotFound, "no such user")
st := status.New(codes.FailedPrecondition, "wrong user role")
detSt, err := st.WithDetails(&rpc.BadRequest{
    FieldViolations: []*rpc.BadRequest_FieldViolation{
        {
            Field:       "role",
            Description: "The first user created must have the role of an ADMIN",
        },
    },
})
if err == nil {
    return detSt.Err()
}
return st.Err()

License

The code is 95% copied from the official gRPC status package, so the gRPC License applies.

Changes

The changes applied include changing the use of the golang/protobuf packages to gogo/protobuf, and changing the generated files from google.golang.org/genproto/googleapis to github.com/gogo/googleapis/.

We've also created an implicit interface fulfilled by all gogo/status errors, for use with grpc/status and the gRPC runtime libraries.

FAQs

Package last updated on 23 Apr 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc