Skip to content

Format all generated files #1073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dprint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"**/*-lock.json",
"**/testdata",
"_submodules/**",
"**/*_generated.go",
"internal/bundled/libs/**",
"internal/lsp/lsproto/_generate/*.json",
"internal/lsp/lsproto/_generate/metaModelSchema.mts",
Expand Down
1 change: 1 addition & 0 deletions internal/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

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

type MessageType uint8

Expand Down
1 change: 1 addition & 0 deletions internal/ast/kind.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ast

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

type Kind int16

Expand Down
1 change: 1 addition & 0 deletions internal/checker/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

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

// ParseFlags

Expand Down
1 change: 1 addition & 0 deletions internal/core/compileroptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

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

type CompilerOptions struct {
AllowJs Tristate `json:"allowJs,omitzero"`
Expand Down
1 change: 1 addition & 0 deletions internal/core/compileroptions_stringer_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/core/languagevariant.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package core

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

type LanguageVariant int32

Expand Down
1 change: 1 addition & 0 deletions internal/core/scriptkind.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package core

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

type ScriptKind int32

Expand Down
1 change: 1 addition & 0 deletions internal/core/tristate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package core

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

// Tristate

Expand Down
1 change: 1 addition & 0 deletions internal/diagnostics/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "github.com/microsoft/typescript-go/internal/stringutil"

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

type Category int32

Expand Down
2,105 changes: 2,105 additions & 0 deletions internal/diagnostics/diagnostics_generated.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/diagnostics/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func main() {
buf.WriteString(`, reportsDeprecated: true`)
}

buf.WriteString("}\n")
buf.WriteString("}\n\n")
}

formatted, err := format.Source(buf.Bytes())
Expand Down
4 changes: 2 additions & 2 deletions internal/lsp/lsproto/_generate/generate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,8 @@ function main() {
fs.writeFileSync(out, generatedCode);

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

console.log(`Successfully generated ${out}`);
}
Expand Down
3 changes: 1 addition & 2 deletions internal/lsp/lsproto/lsp_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
)

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

const hr = "-----------------------------------------------"

var projectNamer = &namer{}
Expand Down
8 changes: 2 additions & 6 deletions internal/testutil/projecttestutil/clientmock_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/testutil/projecttestutil/projecttestutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

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

type TestTypingsInstallerOptions struct {
TypesRegistry []string
Expand Down
1 change: 1 addition & 0 deletions internal/vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
)

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

// FS is a file system abstraction.
type FS interface {
Expand Down
12 changes: 4 additions & 8 deletions internal/vfs/vfsmock/mock_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.