d2plugin: Minor simplification

This commit is contained in:
Anmol Sethi 2022-12-01 14:10:48 -08:00
parent d87d897fdb
commit 9d3eb02406
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA

View file

@ -18,7 +18,7 @@ import (
// See implementation of d2plugin-dagre in the ./cmd directory. // See implementation of d2plugin-dagre in the ./cmd directory.
// //
// Also see execPlugin in exec.go for the d2 binary plugin protocol. // Also see execPlugin in exec.go for the d2 binary plugin protocol.
func Serve(p Plugin) func(context.Context, *xmain.State) error { func Serve(p Plugin) xmain.RunFunc {
return func(ctx context.Context, ms *xmain.State) (err error) { return func(ctx context.Context, ms *xmain.State) (err error) {
if len(ms.Opts.Flags.Args()) < 1 { if len(ms.Opts.Flags.Args()) < 1 {
return errors.New("expected first argument to plugin binary to be function name") return errors.New("expected first argument to plugin binary to be function name")