func newRunFunc(handler Handler) func(context.Context, app.Container) error {
	return func(ctx context.Context, container app.Container) error {
		input, err := io.ReadAll(container.Stdin())
		if err != nil {
			return err
		}
		request := &pluginpb.CodeGeneratorRequest{}
		// We do not know the FileDescriptorSet before unmarshaling this
		if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(input, request); err != nil {
			return err
		}
		if err := protodescriptor.ValidateCodeGeneratorRequest(request); err != nil {
			return err
		}
		responseWriter := newResponseBuilder(container)
		if err := handler.Handle(ctx, container, responseWriter, request); err != nil {
			return err
		}
		response := responseWriter.toResponse()
		if err := protodescriptor.ValidateCodeGeneratorResponse(response); err != nil {
			return err
		}
		data, err := protoencoding.NewWireMarshaler().Marshal(response)
		if err != nil {
			return err
		}
		_, err = container.Stdout().Write(data)
		return err
	}
}
// newRunFunc returns a new RunFunc for app.Main and app.Run.
newRunFunc returns a new RunFunc for app.Main and app.Run.
// newRunFunc returns a new RunFunc for app . Main and app . Run .
func newRunFunc(handler Handler) func(context.Context, app.Container) error {
	return func(ctx context.Context, container app.Container) error {
		input, err := io.ReadAll(container.Stdin())
		if err != nil {
			return err
		}
		request := &pluginpb.CodeGeneratorRequest{}
		if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(input, request); err != nil {
			return err
		}
		if err := protodescriptor.ValidateCodeGeneratorRequest(request); err != nil {
			return err
		}
		responseWriter := newResponseBuilder(container)
		if err := handler.Handle(ctx, container, responseWriter, request); err != nil {
			return err
		}
		response := responseWriter.toResponse()
		if err := protodescriptor.ValidateCodeGeneratorResponse(response); err != nil {
			return err
		}
		data, err := protoencoding.NewWireMarshaler().Marshal(response)
		if err != nil {
			return err
		}
		_, err = container.Stdout().Write(data)
		return err
	}
}
func newRunFunc ( handler Handler ) func ( context . Context , app . Container ) error { return func ( ctx context . Context , container app . Container ) error { input , err := io . ReadAll ( container . Stdin ( ) ) if err != nil { return err } request := & pluginpb . CodeGeneratorRequest { } if err := protoencoding . NewWireUnmarshaler ( nil ) . Unmarshal ( input , request ) ; err != nil { return err } if err := protodescriptor . ValidateCodeGeneratorRequest ( request ) ; err != nil { return err } responseWriter := newResponseBuilder ( container ) if err := handler . Handle ( ctx , container , responseWriter , request ) ; err != nil { return err } response := responseWriter . toResponse ( ) if err := protodescriptor . ValidateCodeGeneratorResponse ( response ) ; err != nil { return err } data , err := protoencoding . NewWireMarshaler ( ) . Marshal ( response ) if err != nil { return err } _ , err = container . Stdout ( ) . Write ( data ) return err } }
newRunFunc returns a new RunFunc for app.Main and app.Run.
newRunFunc returns a new RunFunc for app . Main and app . Run .
// We do not know the FileDescriptorSet before unmarshaling this