From e6d68b3649b3fe920f3de46149dee2a82aa4eba7 Mon Sep 17 00:00:00 2001 From: maguowei Date: Wed, 27 Sep 2023 17:11:54 +0800 Subject: [PATCH] fix config random port. refs: https://github.com/apache/dubbo-go/issues/2382, https://github.com/apache/dubbo-go/pull/2384 --- config/service_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/service_config.go b/config/service_config.go index 1b41aa2721..83cb9c0699 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -263,7 +263,7 @@ func (s *ServiceConfig) Export() error { } port := proto.Port - if len(proto.Port) == 0 { + if num, err := strconv.Atoi(proto.Port); err != nil || num <= 0 { port = nextPort.Value.(string) nextPort = nextPort.Next() }