Skip to content

Commit a92eff4

Browse files
authored
Format all generated files (#1073)
1 parent 3af9097 commit a92eff4

File tree

19 files changed

+2128
-20
lines changed

19 files changed

+2128
-20
lines changed

.dprint.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"**/*-lock.json",
5151
"**/testdata",
5252
"_submodules/**",
53-
"**/*_generated.go",
5453
"internal/bundled/libs/**",
5554
"internal/lsp/lsproto/_generate/*.json",
5655
"internal/lsp/lsproto/_generate/metaModelSchema.mts",

internal/api/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
)
1919

2020
//go:generate go tool golang.org/x/tools/cmd/stringer -type=MessageType -output=stringer_generated.go
21+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w stringer_generated.go
2122

2223
type MessageType uint8
2324

internal/ast/kind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package ast
22

33
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Kind -output=kind_stringer_generated.go
4+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w kind_stringer_generated.go
45

56
type Kind int16
67

internal/checker/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
)
1111

1212
//go:generate go tool golang.org/x/tools/cmd/stringer -type=SignatureKind -output=stringer_generated.go
13+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w stringer_generated.go
1314

1415
// ParseFlags
1516

internal/core/compileroptions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
)
99

1010
//go:generate go tool golang.org/x/tools/cmd/stringer -type=ModuleKind,ScriptTarget -output=compileroptions_stringer_generated.go
11+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w compileroptions_stringer_generated.go
1112

1213
type CompilerOptions struct {
1314
AllowJs Tristate `json:"allowJs,omitzero"`

internal/core/compileroptions_stringer_generated.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/core/languagevariant.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package core
22

33
//go:generate go tool golang.org/x/tools/cmd/stringer -type=LanguageVariant -output=languagevariant_stringer_generated.go
4+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w languagevariant_stringer_generated.go
45

56
type LanguageVariant int32
67

internal/core/scriptkind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package core
22

33
//go:generate go tool golang.org/x/tools/cmd/stringer -type=ScriptKind -output=scriptkind_stringer_generated.go
4+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w scriptkind_stringer_generated.go
45

56
type ScriptKind int32
67

internal/core/tristate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package core
22

33
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Tristate -output=tristate_stringer_generated.go
4+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w tristate_stringer_generated.go
45

56
// Tristate
67

internal/diagnostics/diagnostics.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "github.com/microsoft/typescript-go/internal/stringutil"
55

66
//go:generate go run generate.go -output ./diagnostics_generated.go
77
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Category -output=stringer_generated.go
8+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w diagnostics_generated.go stringer_generated.go
89

910
type Category int32
1011

internal/diagnostics/diagnostics_generated.go

Lines changed: 2105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/diagnostics/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func main() {
8888
buf.WriteString(`, reportsDeprecated: true`)
8989
}
9090

91-
buf.WriteString("}\n")
91+
buf.WriteString("}\n\n")
9292
}
9393

9494
formatted, err := format.Source(buf.Bytes())

internal/lsp/lsproto/_generate/generate.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ function main() {
634634
fs.writeFileSync(out, generatedCode);
635635

636636
// Format with gofmt
637-
const gofmt = which.sync("gofmt");
638-
cp.execFileSync(gofmt, ["-w", out]);
637+
const gofmt = which.sync("go");
638+
cp.execFileSync(gofmt, ["tool", "mvdan.cc/gofumpt", "-lang=go1.24", "-w", out]);
639639

640640
console.log(`Successfully generated ${out}`);
641641
}

internal/lsp/lsproto/lsp_generated.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/project/project.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
)
2424

2525
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Kind -output=project_stringer_generated.go
26+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w project_stringer_generated.go
27+
2628
const hr = "-----------------------------------------------"
2729

2830
var projectNamer = &namer{}

internal/testutil/projecttestutil/clientmock_generated.go

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/testutil/projecttestutil/projecttestutil.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
)
2020

2121
//go:generate go tool github.com/matryer/moq -stub -fmt goimports -pkg projecttestutil -out clientmock_generated.go ../../project Client
22+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w clientmock_generated.go
2223

2324
type TestTypingsInstallerOptions struct {
2425
TypesRegistry []string

internal/vfs/vfs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
)
66

77
//go:generate go tool github.com/matryer/moq -fmt goimports -out vfsmock/mock_generated.go -pkg vfsmock . FS
8+
//go:generate go tool mvdan.cc/gofumpt -lang=go1.24 -w vfsmock/mock_generated.go
89

910
// FS is a file system abstraction.
1011
type FS interface {

internal/vfs/vfsmock/mock_generated.go

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)