Skip to content

Commit af98a81

Browse files
authored
Merge pull request #152 from kpenfound/fix_formatter_go
fix formatters to focus only on file extensions they can format
2 parents 5c26ad9 + eeb3c76 commit af98a81

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

.dagger/backend/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"context"
55
"runtime"
6+
"strings"
67

78
"backend/internal/dagger"
89
)
@@ -125,6 +126,10 @@ func (b *Backend) FormatFile(
125126
// File path to format
126127
path string,
127128
) *dagger.Directory {
129+
// Only format go files
130+
if !strings.HasSuffix(path, ".go") {
131+
return source
132+
}
128133
return dag.
129134
Container().
130135
From("golang:1.24").

.dagger/frontend/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ export class Frontend {
9191

9292
@func()
9393
formatFile(source: Directory, path: string): Directory {
94+
if (
95+
!(path.endsWith(".ts") || path.endsWith(".html") || path.endsWith(".js"))
96+
) {
97+
return source;
98+
}
99+
94100
return dag
95101
.container()
96102
.from("node:23")

0 commit comments

Comments
 (0)