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

proposal: cmd/go: add go work toggle flag (impossible?) #57090

Closed
switchupcb opened this issue Dec 5, 2022 · 6 comments
Closed

proposal: cmd/go: add go work toggle flag (impossible?) #57090

switchupcb opened this issue Dec 5, 2022 · 6 comments

Comments

@switchupcb
Copy link

Repost of #57085 because it was closed due to go env -w, but that command doesn't implement the behavior described.

Step 1: https://github.com/golang/proposal#the-proposal-process
The proposal author creates a brief issue describing the proposal.
Note: There is no need for a design document at this point.
Note: A non-proposal issue can be turned into a proposal by simply adding the proposal label.
Note: Language changes should follow a separate template

Developers are required to use environment variables to switch in and out of workspace mode. This means using set GOWORK=off or export GOWORK=off depending on the platform. This in itself is problematic since you have to give out two different instructions (which depend on the user OS). In order to go back into workspace mode, you need to set the GOWORK variable back. If you are dealing with a long path it's time consuming and prone to error.

Toggle Flag

go work toggle

When GOWORK is set, switches the GO Workspace to off.
When GOWORK is off, switches the GO Workspace to current directory.

Flags

-d - Set directory to switch to using relative path.

@switchupcb switchupcb changed the title proposal: cmd/go: add go work toggle flag #57085 proposal: cmd/go: add go work toggle flag (repost) Dec 5, 2022
@gopherbot gopherbot added this to the Proposal milestone Dec 5, 2022
@ianlancetaylor
Copy link
Contributor

Since you say that this is not go env -w, I don't understand what go work toggle is going to change. It can't change the value of the GOWORK environment variable. And I think it would be very confusing if the GOWORK environment variable were not honored.

@switchupcb
Copy link
Author

switchupcb commented Dec 5, 2022

It can't change the value of the GOWORK environment variable.

Cause the binary won't set the variable of the system. You're right. RIP

@switchupcb switchupcb changed the title proposal: cmd/go: add go work toggle flag (repost) proposal: cmd/go: add go work toggle flag (impossible) Dec 5, 2022
@switchupcb switchupcb changed the title proposal: cmd/go: add go work toggle flag (impossible) proposal: cmd/go: add go work toggle flag (impossible?) Dec 6, 2022
@switchupcb
Copy link
Author

If go env -w can set the environment variable, why can't this command?

go work toggle -> set GOWORK=off
go work toggle -> set GOWORK=<full current directory here>

How does this fail to honor the environment variable?

@switchupcb switchupcb reopened this Dec 6, 2022
@seankhliao
Copy link
Member

We're not going to have multiple ways of doing things, especially something like toggle which is unclear in semantics on what happens when you run it without very clear knowledge of the current state of the system.

Such a thing seems better suited as aliases / local scripts to your environment.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2022
@rsc
Copy link
Contributor

rsc commented Mar 29, 2023

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Apr 6, 2023

This proposal has been declined as infeasible.
— rsc for the proposal review group

@golang golang locked and limited conversation to collaborators Apr 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants