Skip to content

Commit

Permalink
fix: 当服务名称为空时导致 nacos 服务异常的问题 (#202)
Browse files Browse the repository at this point in the history
RegisterInstance func adds serviceName blank character validation
  • Loading branch information
shenqidebaozi authored Mar 30, 2021
1 parent a63411b commit b82babf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clients/naming_client/naming_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ func NewNamingClient(nc nacos_client.INacosClient) (NamingClient, error) {

// 注册服务实例
func (sc *NamingClient) RegisterInstance(param vo.RegisterInstanceParam) (bool, error) {
if param.ServiceName == "" {
return false, errors.New("serviceName cannot be empty!")
}
if len(param.GroupName) == 0 {
param.GroupName = constant.DEFAULT_GROUP
}
Expand Down

0 comments on commit b82babf

Please sign in to comment.