hmm
This commit is contained in:
parent
33d63a564e
commit
09ad76e01d
1 changed files with 4 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"go/parser"
|
||||
"go/token"
|
||||
"log"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
|
@ -16,6 +17,8 @@ func WriteFile(path string, cb func(content *ast.File) string) {
|
|||
|
||||
path = filepath.Join(currentDir, path)
|
||||
|
||||
slog.Debug("astgen.WriteFile", slog.String("path", path))
|
||||
|
||||
dir := filepath.Dir(path)
|
||||
|
||||
os.MkdirAll(dir, 0755)
|
||||
|
|
@ -49,7 +52,7 @@ func WriteFile(path string, cb func(content *ast.File) string) {
|
|||
bytes, err = format.Source(bytes)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Failed to format source: %v\n\n%s", err)
|
||||
log.Printf("Failed to format source: %v\n", err.Error())
|
||||
data := string(bytes)
|
||||
println(data)
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue