Skip to content

proposal: Go Env : Add go.environment #57539

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

Closed
Pat3ickI opened this issue Jan 1, 2023 · 1 comment
Closed

proposal: Go Env : Add go.environment #57539

Pat3ickI opened this issue Jan 1, 2023 · 1 comment

Comments

@Pat3ickI
Copy link

Pat3ickI commented Jan 1, 2023

As Go keep Growing the Go Environment Variables for Configuration is getting complex and their are some programs that requires specific configuration and it may mess up the default environment variables or tedious to setup so I propose we should add a file called go.environment which can be used instead of the default variables or the manual setup.
In the go.environment file

package < directory name > // package may not be needed 

version: < go version >

<go variable and their values>
goos: linux
goarch: ….
goroot: …..


when dealing with a variable that can accept multiple of Values

goexperiment: {
         boringcrypto, arena, unified 
         }

Or

goexperiment: { boringcrypto, arena, unified}

with the command go env init or go env init < directory >

Constraints
The go.environment file can either work or initiate if the directory does not contain package main in any go file since it won’t be useful for any libraries to have it

if GOOS=linux go build *.go This will argument will be treated first than what’s in the file.

We could add comments so it can be easy store some variables when needed // goos: then force the compiler to check for any empty variable goos:
or
If a variable is empty the compiler ignore it and use the default one

If there’s an invalid variable according to the go compiler version it’s either it ignore it or output an error

commands like go env goos=linux modify the file

@gopherbot gopherbot added this to the Proposal milestone Jan 1, 2023
@seankhliao
Copy link
Member

Duplicate of #57179

@seankhliao seankhliao marked this as a duplicate of #57179 Jan 1, 2023
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2023
@golang golang locked and limited conversation to collaborators Jan 1, 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

3 participants