title: How to assert gRPC error codes client side in Go
body: <p>Given the following gRPC server side code:</p>
  
  <pre><code>import (
      "google.golang.org/grpc/codes"
      "google.golang.org/grpc/status"
      ....
  )
  
  ....
  
  func (s *Router) Assign(ctx context.Context, req *api.Request(*api.Response, error) {
  
      return nil, status.Errorf(codes.PermissionDenied,
  }
  
  ....
  </code></pre>
  
  <p>What is the recommended technique for asserting client side that the error is of code = <code>codes.PermissionDenied</code> ?</p>