From 78b71ce62a436f21023b685eb2d15c90ac1db7a4 Mon Sep 17 00:00:00 2001 From: Taichi Sasaki Date: Fri, 17 May 2024 08:40:25 +0900 Subject: [PATCH] Not return nil --- dsl/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsl/server.go b/dsl/server.go index 57dc2684ef..dfb861ef7b 100644 --- a/dsl/server.go +++ b/dsl/server.go @@ -57,15 +57,15 @@ import ( // }) // }) func Server(name string, fn ...func()) *expr.ServerExpr { + server := &expr.ServerExpr{Name: name} if len(fn) > 1 { eval.TooManyArgError() - return nil + return server } api, ok := eval.Current().(*expr.APIExpr) if !ok { eval.IncompatibleDSL() } - server := &expr.ServerExpr{Name: name} if len(fn) > 0 { eval.Execute(fn[0], server) }