Skip to content

Commit

Permalink
fix: lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
EZ4Jam1n committed Aug 11, 2024
1 parent 6f2d9e2 commit 783b0fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions thrift-gen-rpc-swagger/generator/openapi_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
package generator

import (
"fmt"
"path/filepath"
"regexp"
"sort"
Expand Down Expand Up @@ -214,7 +213,7 @@ func (g *OpenAPIGenerator) BuildDocument(arguments *args.Arguments) []*plugin.Ge

bytes, err := d.YAMLValue("Generated with thrift-gen-rpc-swagger\n" + infoURL)
if err != nil {
fmt.Printf("Error converting to yaml: %s\n", err)
logs.Errorf("Error converting to yaml: %s", err)
return nil
}
filePath := filepath.Clean(arguments.OutputDir)
Expand Down
9 changes: 4 additions & 5 deletions thrift-gen-rpc-swagger/generator/server_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ package generator

import (
"bytes"
"fmt"
"os"
"path/filepath"
"text/template"

"github.com/cloudwego/hertz/cmd/hz/util/logs"
"github.com/cloudwego/thriftgo/parser"
"github.com/cloudwego/thriftgo/plugin"
"github.com/hertz-contrib/swagger-generate/thrift-gen-rpc-swagger/args"
Expand All @@ -42,7 +41,7 @@ func NewServerGenerator(ast *parser.Thrift, args *args.Arguments) *ServerGenerat

idlPath := ast.Filename
if idlPath == "" {
fmt.Fprintf(os.Stderr, "IDL file path is empty")
logs.Errorf("IDL file path is empty")
}

hertzAddr := args.HertzAddr
Expand Down Expand Up @@ -71,13 +70,13 @@ func NewServerGenerator(ast *parser.Thrift, args *args.Arguments) *ServerGenerat
func (g *ServerGenerator) Generate() []*plugin.Generated {
tmpl, err := template.New("server").Delims("{{", "}}").Parse(serverTemplate)
if err != nil {
fmt.Sprintf("failed to parse template: %v", err)
logs.Errorf("failed to parse template: %v", err)
}

var buf bytes.Buffer
err = tmpl.Execute(&buf, g)
if err != nil {
fmt.Sprintf("failed to execute template: %v", err)
logs.Errorf("failed to execute template: %v", err)
}

filePath := filepath.Clean(g.OutputDir)
Expand Down

0 comments on commit 783b0fb

Please sign in to comment.