Skip to content

feat: display goos & goarch #881

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sxzz
Copy link

@sxzz sxzz commented May 20, 2025

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
...

@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 01:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the CLI output by appending the host OS and CPU architecture to the compiler version and help header.

  • Append GOOS/GOARCH to printVersion output
  • Include GOOS/GOARCH in the help header format
Comments suppressed due to low confidence (1)

internal/execute/outputs.go:98

  • Add unit tests to verify that printVersion includes runtime.GOOS and runtime.GOARCH in its output for different OS/architecture combinations.
fmt.Fprint(sys.Writer(), diagnostics.Version_0.Format(core.Version)+" "+runtime.GOOS+"/"+runtime.GOARCH+sys.NewLine())

@@ -158,7 +158,7 @@ func printEasyHelp(sys System, simpleOptions []*tsoptions.CommandLineOption) {
output = append(output, " ", desc.Format(), sys.NewLine(), sys.NewLine())
}

Copy link
Preview

Copilot AI May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the project documentation or CLI usage guide (e.g., README) to mention that the version and help output now display the host GOOS/GOARCH information.

Suggested change
// Note: Ensure that the CLI usage guide or README is updated to mention that the version and help output
// now display the host GOOS/GOARCH information (e.g., "linux/amd64").

Copilot uses AI. Check for mistakes.

@jakebailey
Copy link
Member

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.

@LukeAbby
Copy link

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.

@sxzz
Copy link
Author

sxzz commented May 20, 2025

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
Copy link
Author

sxzz commented May 20, 2025

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.

@jakebailey
Copy link
Member

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.

@sxzz
Copy link
Author

sxzz commented May 22, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants