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/parser"
|
||||||
"go/token"
|
"go/token"
|
||||||
"log"
|
"log"
|
||||||
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
@ -16,6 +17,8 @@ func WriteFile(path string, cb func(content *ast.File) string) {
|
||||||
|
|
||||||
path = filepath.Join(currentDir, path)
|
path = filepath.Join(currentDir, path)
|
||||||
|
|
||||||
|
slog.Debug("astgen.WriteFile", slog.String("path", path))
|
||||||
|
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
|
|
||||||
os.MkdirAll(dir, 0755)
|
os.MkdirAll(dir, 0755)
|
||||||
|
|
@ -49,7 +52,7 @@ func WriteFile(path string, cb func(content *ast.File) string) {
|
||||||
bytes, err = format.Source(bytes)
|
bytes, err = format.Source(bytes)
|
||||||
|
|
||||||
if err != nil {
|
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)
|
data := string(bytes)
|
||||||
println(data)
|
println(data)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue