fix astgen path issues
This commit is contained in:
parent
b2e76ffae0
commit
a55bd1a2b4
2 changed files with 4 additions and 4 deletions
|
|
@ -292,12 +292,12 @@ func formatRoute(path string) string {
|
||||||
return "/"
|
return "/"
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(path, "/") {
|
if !strings.HasPrefix(path, "/") {
|
||||||
path = "/" + path
|
path = filepath.Join("/", path)
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(path, "/") {
|
if strings.HasSuffix(path, "/") {
|
||||||
return path[:len(path)-1]
|
return strings.ReplaceAll(path[:len(path)-1], `\`, "/")
|
||||||
}
|
}
|
||||||
return path
|
return strings.ReplaceAll(filepath.Clean(path), `\`, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
func writePagesFile() {
|
func writePagesFile() {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ func WriteFile(path string, cb func(content *ast.File) string) {
|
||||||
|
|
||||||
slog.Debug("astgen.WriteFile", slog.String("path", path), slog.String("content", string(bytes)))
|
slog.Debug("astgen.WriteFile", slog.String("path", path), slog.String("content", string(bytes)))
|
||||||
|
|
||||||
formatEnabled := false
|
formatEnabled := true
|
||||||
|
|
||||||
if formatEnabled {
|
if formatEnabled {
|
||||||
bytes, err = format.Source(bytes)
|
bytes, err = format.Source(bytes)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue