What happened?
Running na tsgo inside a workspace package directory can hang indefinitely (100% CPU) with no output.
This looks like @typescript/native-preview/tsgo spinning during startup when it can't find a go.mod in the current working directory (see stack trace below). I can reproduce the hang even when invoking the tsgo binary directly, so this is probably upstream, but na is currently a very easy way to hit it.
Repro
- macOS 26.2 (arm64)
@antfu/ni v28.0.0
- node v25.2.1
- bun v1.3.5
@typescript/native-preview 7.0.0-dev.20251218.1
Minimal repro steps:
- In a monorepo with a workspace package (e.g.
cli/) that has tsconfig.json but no go.mod in that directory.
- Install
@typescript/native-preview.
- Run:
cd cli
na tsgo --help
# or
na tsgo --noEmit
Expected
tsgo prints help / completes typecheck and exits.
Actual
The process never terminates (busy loop).
Evidence (SIGQUIT stack trace)
After ~5s, sending SIGQUIT shows it stuck in github.com/microsoft/typescript-go/internal/repo.findGoMod calling os.Stat("go.mod"):
github.com/microsoft/typescript-go/internal/repo.findGoMod
github.com/microsoft/typescript-go/internal/repo/paths.go:30
github.com/microsoft/typescript-go/internal/repo.init.0
github.com/microsoft/typescript-go/internal/repo/paths.go:22
Workarounds
- Run from a directory that contains a
go.mod (even an empty one), or
- Invoke tsgo from repo root and pass
-p:
na tsgo --noEmit -p cli/tsconfig.json
Ask
Even if the root cause is upstream, would you accept a guard/diagnostic in na to detect this specific tsgo busy-hang scenario (e.g. if cmd == tsgo and there is no go.mod in cwd, print a warning suggesting -p or adding go.mod)?
If you’d prefer this to be filed upstream only, I can open an issue in microsoft/typescript-go instead.
What happened?
Running
na tsgoinside a workspace package directory can hang indefinitely (100% CPU) with no output.This looks like
@typescript/native-preview/tsgospinning during startup when it can't find ago.modin the current working directory (see stack trace below). I can reproduce the hang even when invoking thetsgobinary directly, so this is probably upstream, butnais currently a very easy way to hit it.Repro
@antfu/niv28.0.0@typescript/native-preview7.0.0-dev.20251218.1Minimal repro steps:
cli/) that hastsconfig.jsonbut nogo.modin that directory.@typescript/native-preview.Expected
tsgoprints help / completes typecheck and exits.Actual
The process never terminates (busy loop).
Evidence (SIGQUIT stack trace)
After ~5s, sending
SIGQUITshows it stuck ingithub.com/microsoft/typescript-go/internal/repo.findGoModcallingos.Stat("go.mod"):Workarounds
go.mod(even an empty one), or-p:Ask
Even if the root cause is upstream, would you accept a guard/diagnostic in
nato detect this specifictsgobusy-hang scenario (e.g. ifcmd == tsgoand there is nogo.modin cwd, print a warning suggesting-por addinggo.mod)?If you’d prefer this to be filed upstream only, I can open an issue in
microsoft/typescript-goinstead.