The use case is for binaries that serve a gRPC server on a listener, where both a deferred function and grpc.(*Server).GracefulStop will close the listener:
$ go doc google.golang.org/grpc Server.GracefulStop
package grpc // import "google.golang.org/grpc"
func (s *Server) GracefulStop()
GracefulStop stops the gRPC server gracefully. It stops the server from
accepting new connections and RPCs and blocks until all the pending RPCs are
finished.
See https://tip.golang.org/doc/go1.16#net for more details.
The use case is for binaries that serve a gRPC server on a listener, where both a deferred function and
grpc.(*Server).GracefulStop
will close the listener: