mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
chore: upgrade Go version to 1.24 and update dependencies (#5499)
This commit is contained in:
@@ -197,7 +197,7 @@ func (p *printer) print(x reflect.Value) {
|
||||
|
||||
case reflect.Struct:
|
||||
if val, ok := x.Interface().(apitoken.Position); ok {
|
||||
p.printf(val.String())
|
||||
p.printf("%s", val.String())
|
||||
return
|
||||
}
|
||||
t := x.Type()
|
||||
|
||||
@@ -357,7 +357,7 @@ func (w *Writer) Write(opts ...Option) {
|
||||
|
||||
// WriteText writes the text.
|
||||
func (w *Writer) WriteText(text string) {
|
||||
_, _ = fmt.Fprintf(w.tw, text)
|
||||
_, _ = fmt.Fprint(w.tw, text)
|
||||
}
|
||||
|
||||
func (w *Writer) write(opt *option) {
|
||||
|
||||
@@ -284,7 +284,7 @@ func (api *API) parseImportedAPI(imports []ast.ImportStmt) ([]*API, error) {
|
||||
}
|
||||
// import cycle check
|
||||
if err := api.importManager.Push(impPath); err != nil {
|
||||
return nil, ast.SyntaxError(tok.Position, err.Error())
|
||||
return nil, ast.SyntaxError(tok.Position, "%s", err.Error())
|
||||
}
|
||||
|
||||
if _, ok := api.importSet[impPath]; ok {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -24,5 +24,5 @@ func (e *errorManager) error() error {
|
||||
if len(e.errors) == 0 {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf(strings.Join(e.errors, "\n"))
|
||||
return errors.New(strings.Join(e.errors, "\n"))
|
||||
}
|
||||
|
||||
@@ -1676,7 +1676,7 @@ func (p *Parser) CheckErrors() error {
|
||||
errors = append(errors, e.Error())
|
||||
}
|
||||
|
||||
return fmt.Errorf(strings.Join(errors, "\n"))
|
||||
return fmt.Errorf("%s", strings.Join(errors, "\n"))
|
||||
}
|
||||
|
||||
func (p *Parser) appendStmt(stmt ...ast.Stmt) {
|
||||
|
||||
@@ -130,7 +130,7 @@ func TestParser_Parse_infoStmt(t *testing.T) {
|
||||
"author": `"type author here"`,
|
||||
"email": `"type email here"`,
|
||||
"version": `"type version here"`,
|
||||
"enable": `true`,
|
||||
"enable": `true`,
|
||||
"disable": `false`,
|
||||
}
|
||||
p := New("foo.api", infoTestAPI)
|
||||
@@ -762,6 +762,11 @@ func TestParser_Parse_service(t *testing.T) {
|
||||
}),
|
||||
},
|
||||
Request: &ast.BodyStmt{
|
||||
LParen: ast.NewTokenNode(token.Token{Type: token.LPAREN, Text: "("}),
|
||||
RParen: ast.NewTokenNode(token.Token{Type: token.RPAREN, Text: ")"}),
|
||||
},
|
||||
Returns: ast.NewTokenNode(token.Token{Type: token.IDENT, Text: "returns"}),
|
||||
Response: &ast.BodyStmt{
|
||||
LParen: ast.NewTokenNode(token.Token{Type: token.LPAREN, Text: "("}),
|
||||
Body: &ast.BodyExpr{
|
||||
Value: ast.NewTokenNode(token.Token{Type: token.IDENT, Text: "Foo"}),
|
||||
|
||||
Reference in New Issue
Block a user