MCPcopy Create free account
hub / github.com/cli/cli / newServerOpts

Function newServerOpts

internal/barista/observability/telemetry.twirp.go:571–586  ·  view source on GitHub ↗
(opts []interface{})

Source from the content-addressed store, hash-verified

569}
570
571func newServerOpts(opts []interface{}) *twirp.ServerOptions {
572 serverOpts := &twirp.ServerOptions{}
573 for _, opt := range opts {
574 switch o := opt.(type) {
575 case twirp.ServerOption:
576 o(serverOpts)
577 case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument
578 twirp.WithServerHooks(o)(serverOpts)
579 case nil: // backwards compatibility, allow nil value for the argument
580 continue
581 default:
582 panic(fmt.Sprintf("Invalid option type %T, please use a twirp.ServerOption", o))
583 }
584 }
585 return serverOpts
586}
587
588// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).
589// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.

Callers 1

NewTelemetryAPIServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected