typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

feat: display goos & goarch

Open sxzz opened this issue 6 months ago • 6 comments

Since the build of TypeScript Go depends on the operating system and CPU architecture, it also outputs GOOS and GOARCH accordingly.

❯ tsc -v
Version 7.0.0-dev darwin/arm64

❯ tsc -h
tsc: The TypeScript Compiler - Version 7.0.0-dev - darwin/arm64
...

sxzz avatar May 20 '25 01:05 sxzz

I don't think this is useful; a user probably already knows what kind of system they're running on. That and, this text cannot change as it's a "load-bearing" string that people parse.

jakebailey avatar May 20 '25 01:05 jakebailey

That and, this text cannot change as it's a "load-bearing" string that people parse.

Horrifying but I guess I shouldn't be surprised.

LukeAbby avatar May 20 '25 01:05 LukeAbby

Some operating systems, including macOS and Windows, support running x86/x64 programs on Arm hardware through compatibility layers, but performance is significantly reduced. Providing this information helps users identify and choose the binary that best suits their system.

sxzz avatar May 20 '25 01:05 sxzz

Considering compatibility with 5.x, do you think this minor change is acceptable?

As for parsing, the tsc -v command still separates the version with a space, ensuring that commands like tsc -v | awk '{print $2}' (or similar approaches) will continue to work without any changes.

sxzz avatar May 20 '25 01:05 sxzz

I just don't think it's required. I don't know of any other application which does this, outside go itself, which is a compiler that produces native code. The GOOS/GOARCH that people see will just match their version of Node, because it'll be installed from npm.

jakebailey avatar May 22 '25 18:05 jakebailey

This information is already included in all CLI programs that use CAC. See https://www.npmjs.com/browse/depended/cac

❯ pnpx vite -v
vite/6.3.5 darwin-arm64 node-v22.16.0
❯ pnpx vitest -v
vitest/3.1.4 darwin-arm64 node-v22.16.0
❯ pnpx tsup -v
tsup/8.5.0 darwin-arm64 node-v22.16.0
❯ pnpx @unocss/cli -v
unocss/66.1.2 darwin-arm64 node-v22.16.0

Please feel free to close the PR if you don't find it helpful.

sxzz avatar May 22 '25 19:05 sxzz

Let's revisit this when the need arises. For now, we'd like to keep the TS6/TS7 delta as small as possible.

RyanCavanaugh avatar Jun 25 '25 15:06 RyanCavanaugh