Skip to content

Update to Go 1.24 #339

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 22 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from 20 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
2 changes: 1 addition & 1 deletion .custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json

version: v1.63.4
version: v1.64.6

destination: ./_tools

Expand Down
2 changes: 1 addition & 1 deletion .dprint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"cwd": "${configDir}",
"cacheKey": "4",
"commands": [
{ "command": "gofumpt -lang=go1.23", "exts": ["go"] }
{ "command": "gofumpt -lang=go1.24", "exts": ["go"] }
]
},
"excludes": [
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Setup Go
inputs:
go-version:
description: Go version range to set up.
default: '>=1.23.0'
default: '>=1.24.1'
cache-name:
description: Name of scoped cache for this set up.
default: 'cache'
Expand Down
2 changes: 1 addition & 1 deletion _tools/customlint/testdata/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module testdata

go 1.23.3
go 1.24.1
10 changes: 5 additions & 5 deletions _tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/microsoft/typescript-go/_tools

go 1.23.3
go 1.24.1

require (
github.com/golangci/plugin-module-register v0.1.1
golang.org/x/tools v0.27.1-0.20241128223349-e7bd2274d184
gotest.tools/v3 v3.5.1
golang.org/x/tools v0.30.0
gotest.tools/v3 v3.5.2
)

require (
github.com/google/go-cmp v0.6.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
)
16 changes: 8 additions & 8 deletions _tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+
github.com/golangci/plugin-module-register v0.1.1/go.mod h1:TTpqoB6KkwOJMV8u7+NyXMrkwwESJLOkfl9TxR1DGFc=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.27.1-0.20241128223349-e7bd2274d184 h1:wi4Jz8kRE1yU2JFOi7/w75M61R6mfyCS24FzCFKMuHI=
golang.org/x/tools v0.27.1-0.20241128223349-e7bd2274d184/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
20 changes: 11 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
module github.com/microsoft/typescript-go

go 1.23.3
go 1.24.1

require (
github.com/dlclark/regexp2 v1.11.4
github.com/go-json-experiment/json v0.0.0-20241127185351-9802db03f36a
github.com/google/go-cmp v0.6.0
github.com/dlclark/regexp2 v1.11.5
github.com/go-json-experiment/json v0.0.0-20250223041408-d3c622f1b874
github.com/google/go-cmp v0.7.0
github.com/pkg/diff v0.0.0-20241224192749-4e6772a4315c
golang.org/x/sys v0.27.0
golang.org/x/tools v0.27.0
gotest.tools/v3 v3.5.1
golang.org/x/sys v0.30.0
gotest.tools/v3 v3.5.2
)

require (
golang.org/x/mod v0.22.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/tools v0.30.0 // indirect
)

tool golang.org/x/tools/cmd/stringer
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/go-json-experiment/json v0.0.0-20241127185351-9802db03f36a h1:W/o3DbExdFptoPsZlbGsFnm0f8xDce+C0+Y0u54mJo4=
github.com/go-json-experiment/json v0.0.0-20241127185351-9802db03f36a/go.mod h1:BWmvoE1Xia34f3l/ibJweyhrT+aROb/FQ6d+37F0e2s=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/go-json-experiment/json v0.0.0-20250223041408-d3c622f1b874 h1:F8d1AJ6M9UQCavhwmO6ZsrYLfG8zVFWfEfMS2MXPkSY=
github.com/go-json-experiment/json v0.0.0-20250223041408-d3c622f1b874/go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/pkg/diff v0.0.0-20241224192749-4e6772a4315c h1:8TRxBMS/YsupXoOiGKHr9ZOXo+5DezGWPgBAhBHEHto=
github.com/pkg/diff v0.0.0-20241224192749-4e6772a4315c/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
2 changes: 1 addition & 1 deletion internal/ast/kind.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

//go:generate go run golang.org/x/tools/cmd/stringer -type=Kind -output=kind_stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Kind -output=kind_stringer_generated.go

type Kind int16

Expand Down
2 changes: 1 addition & 1 deletion internal/checker/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/microsoft/typescript-go/internal/core"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=SignatureKind -output=stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=SignatureKind -output=stringer_generated.go

// ParseFlags

Expand Down
11 changes: 8 additions & 3 deletions internal/collections/ordered_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ func resolveKeyName(k reflect.Value) (string, error) {
panic("unexpected map key type")
}

var (
_ json.Unmarshaler = (*OrderedMap[string, string])(nil)
_ json2.UnmarshalerFrom = (*OrderedMap[string, string])(nil)
)

func (m *OrderedMap[K, V]) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
// By convention, to approximate the behavior of Unmarshal itself,
Expand Down Expand Up @@ -284,7 +289,7 @@ func (m *OrderedMap[K, V]) UnmarshalJSON(data []byte) error {
return nil
}

func (m *OrderedMap[K, V]) UnmarshalJSONV2(dec *jsontext.Decoder, opts json2.Options) error {
func (m *OrderedMap[K, V]) UnmarshalJSONFrom(dec *jsontext.Decoder) error {
token, err := dec.ReadToken()
if err != nil {
return err
Expand All @@ -301,10 +306,10 @@ func (m *OrderedMap[K, V]) UnmarshalJSONV2(dec *jsontext.Decoder, opts json2.Opt
for dec.PeekKind() != '}' { // jsontext.ObjectEnd.Kind()
var key K
var value V
if err := json2.UnmarshalDecode(dec, &key, opts); err != nil {
if err := json2.UnmarshalDecode(dec, &key); err != nil {
return err
}
if err := json2.UnmarshalDecode(dec, &value, opts); err != nil {
if err := json2.UnmarshalDecode(dec, &value); err != nil {
return err
}
m.Set(key, value)
Expand Down
2 changes: 1 addition & 1 deletion internal/compiler/diagnostics/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package diagnostics
import "github.com/microsoft/typescript-go/internal/stringutil"

//go:generate go run generate.go -output ./diagnostics_generated.go
//go:generate go run golang.org/x/tools/cmd/stringer -type=Category -output=stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Category -output=stringer_generated.go

type Category int32

Expand Down
11 changes: 9 additions & 2 deletions internal/compiler/packagejson/exportsorimports.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package packagejson

import (
"encoding/json"

json2 "github.com/go-json-experiment/json"
"github.com/go-json-experiment/json/jsontext"
"github.com/microsoft/typescript-go/internal/collections"
Expand All @@ -21,12 +23,17 @@ type ExportsOrImports struct {
objectKind objectKind
}

var (
_ json.Unmarshaler = (*ExportsOrImports)(nil)
_ json2.UnmarshalerFrom = (*ExportsOrImports)(nil)
)

func (e *ExportsOrImports) UnmarshalJSON(data []byte) error {
return unmarshalJSONValue[ExportsOrImports](&e.JSONValue, data)
}

func (e *ExportsOrImports) UnmarshalJSONV2(dec *jsontext.Decoder, opts json2.Options) error {
return unmarshalJSONValueV2[ExportsOrImports](&e.JSONValue, dec, opts)
func (e *ExportsOrImports) UnmarshalJSONFrom(dec *jsontext.Decoder) error {
return unmarshalJSONValueV2[ExportsOrImports](&e.JSONValue, dec)
}

func (e ExportsOrImports) AsObject() *collections.OrderedMap[string, ExportsOrImports] {
Expand Down
23 changes: 14 additions & 9 deletions internal/compiler/packagejson/jsonvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ func (v JSONValue) AsArray() []JSONValue {
return v.Value.([]JSONValue)
}

var (
_ json.Unmarshaler = (*JSONValue)(nil)
_ json2.UnmarshalerFrom = (*JSONValue)(nil)
)

func (v *JSONValue) UnmarshalJSON(data []byte) error {
return unmarshalJSONValue[JSONValue](v, data)
}

func (v *JSONValue) UnmarshalJSONV2(dec *jsontext.Decoder, opts json2.Options) error {
return unmarshalJSONValueV2[JSONValue](v, dec, opts)
func (v *JSONValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error {
return unmarshalJSONValueV2[JSONValue](v, dec)
}

func unmarshalJSONValue[T any](v *JSONValue, data []byte) error {
Expand Down Expand Up @@ -115,7 +120,7 @@ func unmarshalJSONValue[T any](v *JSONValue, data []byte) error {
return nil
}

func unmarshalJSONValueV2[T any](v *JSONValue, dec *jsontext.Decoder, opts json2.Options) error {
func unmarshalJSONValueV2[T any](v *JSONValue, dec *jsontext.Decoder) error {
switch dec.PeekKind() {
case 'n': // jsontext.Null.Kind()
if _, err := dec.ReadToken(); err != nil {
Expand All @@ -126,17 +131,17 @@ func unmarshalJSONValueV2[T any](v *JSONValue, dec *jsontext.Decoder, opts json2
return nil
case '"':
v.Type = JSONValueTypeString
if err := json2.UnmarshalDecode(dec, &v.Value, opts); err != nil {
if err := json2.UnmarshalDecode(dec, &v.Value); err != nil {
return err
}
case '[':
if _, err := dec.ReadToken(); err != nil {
return err
}
var elements []T
for dec.PeekKind() != jsontext.ArrayEnd.Kind() {
for dec.PeekKind() != jsontext.EndArray.Kind() {
var element T
if err := json2.UnmarshalDecode(dec, &element, opts); err != nil {
if err := json2.UnmarshalDecode(dec, &element); err != nil {
return err
}
elements = append(elements, element)
Expand All @@ -148,19 +153,19 @@ func unmarshalJSONValueV2[T any](v *JSONValue, dec *jsontext.Decoder, opts json2
v.Value = elements
case '{':
var object collections.OrderedMap[string, T]
if err := json2.UnmarshalDecode(dec, &object, opts); err != nil {
if err := json2.UnmarshalDecode(dec, &object); err != nil {
return err
}
v.Type = JSONValueTypeObject
v.Value = &object
case 't', 'f': // jsontext.True.Kind(), jsontext.False.Kind()
v.Type = JSONValueTypeBoolean
if err := json2.UnmarshalDecode(dec, &v.Value, opts); err != nil {
if err := json2.UnmarshalDecode(dec, &v.Value); err != nil {
return err
}
default:
v.Type = JSONValueTypeNumber
if err := json2.UnmarshalDecode(dec, &v.Value, opts); err != nil {
if err := json2.UnmarshalDecode(dec, &v.Value); err != nil {
return err
}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/compiler/packagejson/packagejson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func BenchmarkPackageJSON(b *testing.B) {
content := []byte(f.ReadFile(b))
b.Run("UnmarshalJSON", func(b *testing.B) {
b.Run(f.Name(), func(b *testing.B) {
for range b.N {
for b.Loop() {
var p packagejson.Fields
if err := json.Unmarshal(content, &p); err != nil {
b.Fatal(err)
Expand All @@ -35,7 +35,7 @@ func BenchmarkPackageJSON(b *testing.B) {

b.Run("UnmarshalJSONV2", func(b *testing.B) {
b.Run(f.Name(), func(b *testing.B) {
for range b.N {
for b.Loop() {
var p packagejson.Fields
if err := json2.Unmarshal(content, &p); err != nil {
b.Fatal(err)
Expand All @@ -47,7 +47,7 @@ func BenchmarkPackageJSON(b *testing.B) {
b.Run("ParseJSONText", func(b *testing.B) {
b.Run(f.Name(), func(b *testing.B) {
fileName := "/" + f.Name()
for range b.N {
for b.Loop() {
parser.ParseJSONText(fileName, tspath.Path(fileName), string(content))
}
})
Expand Down
2 changes: 1 addition & 1 deletion internal/core/compileroptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/microsoft/typescript-go/internal/tspath"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=ModuleKind,ScriptTarget -output=compileroptions_stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=ModuleKind,ScriptTarget -output=compileroptions_stringer_generated.go

type CompilerOptions struct {
AllowJs Tristate `json:"allowJs"`
Expand Down
2 changes: 1 addition & 1 deletion internal/core/languagevariant.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package core

//go:generate go run golang.org/x/tools/cmd/stringer -type=LanguageVariant -output=languagevariant_stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=LanguageVariant -output=languagevariant_stringer_generated.go

type LanguageVariant int32

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

//go:generate go run golang.org/x/tools/cmd/stringer -type=ScriptKind -output=scriptkind_stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=ScriptKind -output=scriptkind_stringer_generated.go

type ScriptKind int32

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

//go:generate go run golang.org/x/tools/cmd/stringer -type=Tristate -output=tristate_stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Tristate -output=tristate_stringer_generated.go

// Tristate

Expand Down
6 changes: 2 additions & 4 deletions internal/jsnum/jsnum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,15 @@ func TestToInt32(t *testing.T) {
}
}

var sink int32

func BenchmarkToInt32(b *testing.B) {
for _, test := range toInt32Tests {
if !test.bench {
continue
}

b.Run(fmt.Sprintf("%s (%v)", test.name, float64(test.input)), func(b *testing.B) {
for range b.N {
sink = test.input.toInt32()
for b.Loop() {
test.input.toInt32()
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func BenchmarkParse(b *testing.B) {
for _, jsdoc := range jsdocModes {
b.Run(jsdoc.name, func(b *testing.B) {
jsdocMode := jsdoc.mode
for range b.N {
for b.Loop() {
ParseSourceFile(fileName, path, sourceText, core.ScriptTargetESNext, jsdocMode)
}
})
Expand Down
2 changes: 1 addition & 1 deletion internal/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/microsoft/typescript-go/internal/vfs"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=Kind -output=project_stringer_generated.go
//go:generate go tool golang.org/x/tools/cmd/stringer -type=Kind -output=project_stringer_generated.go

var projectNamer = &namer{}

Expand Down
Loading