// Serve serves a plugin. This function never returns and should be the final
// function called in the main function of the plugin.
Serve serves a plugin. This function never returns and should be the final
function called in the main function of the plugin.
// Serve serves a plugin . This function never returns and should be the final // function called in the main function of the plugin .
func Serve(opts *ServeOpts) {
	if opts.GRPCProviderFunc == nil && opts.ProviderFunc != nil {
		provider := grpcplugin.NewGRPCProviderServerShim(opts.ProviderFunc())
		if provider != nil {
			opts.GRPCProviderFunc = func() proto.ProviderServer {
				return provider
			}
		}
	}
	plugin.Serve(&plugin.ServeConfig{
		HandshakeConfig:  Handshake,
		VersionedPlugins: pluginSet(opts),
		GRPCServer:       plugin.DefaultGRPCServer,
		Logger:           opts.Logger,
		Test:             opts.TestConfig,
	})
}
func Serve ( opts * ServeOpts ) { if opts . GRPCProviderFunc == nil && opts . ProviderFunc != nil { provider := grpcplugin . NewGRPCProviderServerShim ( opts . ProviderFunc ( ) ) if provider != nil { opts . GRPCProviderFunc = func ( ) proto . ProviderServer { return provider } } } plugin . Serve ( & plugin . ServeConfig { HandshakeConfig : Handshake , VersionedPlugins : pluginSet ( opts ) , GRPCServer : plugin . DefaultGRPCServer , Logger : opts . Logger , Test : opts . TestConfig , } ) }
Serve serves a plugin.
Serve serves a plugin .
// since the plugins may not yet be aware of the new protocol, we // automatically wrap the plugins in the grpc shims. // this is almost always going to be a *schema.Provider, but check that // we got back a valid provider just in case.