Skip to content
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

Expose the GOARCH runtime constant to CLI users #1692

Closed
jpluscplusm opened this issue Apr 30, 2022 · 2 comments
Closed

Expose the GOARCH runtime constant to CLI users #1692

jpluscplusm opened this issue Apr 30, 2022 · 2 comments
Assignees
Labels
FeatureRequest New feature or request

Comments

@jpluscplusm
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

I'd like to access information about the runtime that's executing the cue CLI, so I can fetch appropriate binaries for an outside-of-CUE-land purpose. I can already access the OS information via the os system tag, and it seems like a bit of an arbitrary choice not to be able to do the same for the only other similarly-situated runtime variable that Go makes available: runtime.GOARCH.

Describe the solution you'd like

I'd like arch to be available as a system tag, when the --inject-vars flag is used.

I have implemented this as PR #1689.

Describe alternatives you've considered

I currently hackily script around the cue invocation and interrogate various uname outputs. I have an incomplete map of uname -m to possible GOARCH variants that I populate manually, and feed into the cue invocation as tags. The CLI runtime has this information available at its fingertips, and it doesn't seem like a stretch to ask it to expose the info.

Additional context

Go's runtime package makes 3 top-level constants available: the name of the tool that built the running binary, the OS, and the architecture. Of those, only the last 2 are relevant to the in-CUE consumer, and it seems arbitrary to make only 1 of them available as a system variable.

I don't believe there's a slippery-slope argument to counter, here. The associated PR (#1689) isn't serving as precedent to open the flood gates to a wider set of variables: it's just going some small way to realign the capabilities of cue CLI users with folks who are consuming CUE in Go.

@jpluscplusm jpluscplusm added FeatureRequest New feature or request Triage Requires triage/attention labels Apr 30, 2022
@rogpeppe rogpeppe removed the Triage Requires triage/attention label May 4, 2022
@myitcv
Copy link
Member

myitcv commented May 5, 2022

I vaguely remember this coming up at the time we introduced tag vars. Sounds good to me. But I defer to @mpvl for a final decision.

@mpvl
Copy link
Member

mpvl commented May 18, 2022

Yes, adding the arch is in line with the other supported values.

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

Successfully merging a pull request may close this issue.

4 participants