chore: coding style (#3074)
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/zeromicro/go-zero/core/errorx"
|
||||
|
||||
"github.com/zeromicro/go-zero/tools/goctl/api/parser"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/api/util"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/pkg/env"
|
||||
|
||||
@@ -179,8 +179,8 @@ func (p parser) fieldToMember(field *ast.TypeField) spec.Member {
|
||||
if !field.IsAnonymous {
|
||||
name = field.Name.Text()
|
||||
if field.Tag == nil {
|
||||
panic(fmt.Sprintf("error: line %d:%d field %s has no tag", field.Name.Line(), field.Name.Column(),
|
||||
field.Name.Text()))
|
||||
panic(fmt.Sprintf("error: line %d:%d field %s has no tag",
|
||||
field.Name.Line(), field.Name.Column(), field.Name.Text()))
|
||||
}
|
||||
|
||||
tag = field.Tag.Text()
|
||||
@@ -232,6 +232,7 @@ func (p parser) stringExprs(docs []ast.Expr) []string {
|
||||
if item == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
result = append(result, item.Text())
|
||||
}
|
||||
return result
|
||||
@@ -293,11 +294,12 @@ func (p parser) fillService() error {
|
||||
}
|
||||
|
||||
group.Routes = append(group.Routes, route)
|
||||
|
||||
name := item.ServiceApi.Name.Text()
|
||||
if len(p.spec.Service.Name) > 0 && p.spec.Service.Name != name {
|
||||
return fmt.Errorf("multiple service names defined %s and %s", name, p.spec.Service.Name)
|
||||
return fmt.Errorf("multiple service names defined %s and %s",
|
||||
name, p.spec.Service.Name)
|
||||
}
|
||||
|
||||
p.spec.Service.Name = name
|
||||
}
|
||||
groups = append(groups, group)
|
||||
|
||||
Reference in New Issue
Block a user