Skip to content

Commit

Permalink
update log, fix log info create new buffer in vim issue
Browse files Browse the repository at this point in the history
  • Loading branch information
momaek committed Apr 22, 2021
1 parent 0c636a2 commit 085bfc0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"go/parser"
"go/token"
"io/ioutil"
"log"
"os"
"strconv"
"strings"
Expand All @@ -24,26 +23,28 @@ type config struct {
}

func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
err := do()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}

}

func do() (err error) {
c, err := parseConfig(os.Args[1:])
if err != nil {
log.Fatal(err)
return
}

node, err := c.parse()
if err != nil {
log.Fatal(err)
return
}

c.format(node)
err = c.write(node)
if err != nil {
log.Fatal("write file failed", err)
}

return
}

func (c *config) write(node ast.Node) error {
Expand Down Expand Up @@ -152,7 +153,6 @@ func (c *config) preProcessStruct(st *ast.StructType, inline ...bool) {

tags, err := structtag.Parse(tag)
if err != nil {
log.Printf("parse tag failed %v, Field: %v, Tag: %s", err, field.Names, field.Tag.Value)
continue
}

Expand Down

0 comments on commit 085bfc0

Please sign in to comment.