diff --git a/core/logx/logs.go b/core/logx/logs.go index 0e8ba160..068ce0a3 100644 --- a/core/logx/logs.go +++ b/core/logx/logs.go @@ -197,7 +197,7 @@ func Disable() { }) } -// DisableStat to disable stat logs +// DisableStat disables the stat logs. func DisableStat() { atomic.StoreUint32(&disableStat, 1) } diff --git a/tools/goctl/api/parser/g4/ast/ast.go b/tools/goctl/api/parser/g4/ast/ast.go index 77126875..b166d2e7 100644 --- a/tools/goctl/api/parser/g4/ast/ast.go +++ b/tools/goctl/api/parser/g4/ast/ast.go @@ -104,6 +104,7 @@ func (v *ApiVisitor) newExprWithTerminalNode(node antlr.TerminalNode) *defaultEx if node == nil { return nil } + token := node.GetSymbol() return v.newExprWithToken(token) } @@ -132,6 +133,7 @@ func (v *ApiVisitor) newExprWithText(text string, line, column, start, stop int) instance.column = column instance.start = start instance.stop = stop + return instance } @@ -248,8 +250,7 @@ func EqualDoc(spec1, spec2 Spec) bool { } func (v *ApiVisitor) getDoc(t TokenStream) []Expr { - list := v.getHiddenTokensToLeft(t, api.COMEMNTS, false) - return list + return v.getHiddenTokensToLeft(t, api.COMEMNTS, false) } func (v *ApiVisitor) getComment(t TokenStream) Expr { @@ -273,11 +274,9 @@ func (v *ApiVisitor) getComment(t TokenStream) Expr { func (v *ApiVisitor) getHiddenTokensToLeft(t TokenStream, channel int, containsCommentOfDefaultChannel bool) []Expr { ct := t.GetParser().GetTokenStream().(*antlr.CommonTokenStream) tokens := ct.GetHiddenTokensToLeft(t.GetStart().GetTokenIndex(), channel) - tmp := make([]antlr.Token, len(tokens)) - copy(tmp, tokens) var list []Expr - for _, each := range tmp { + for _, each := range tokens { if !containsCommentOfDefaultChannel { index := each.GetTokenIndex() - 1 diff --git a/tools/goctl/api/parser/parser.go b/tools/goctl/api/parser/parser.go index 597fe9e7..12099b60 100644 --- a/tools/goctl/api/parser/parser.go +++ b/tools/goctl/api/parser/parser.go @@ -66,7 +66,6 @@ func (p parser) convert2Spec() error { func (p parser) fillInfo() { properties := make(map[string]string) if p.ast.Info != nil { - p.spec.Info = spec.Info{} for _, kv := range p.ast.Info.Kvs { properties[kv.Key.Text()] = kv.Value.Text() }