3 ms·
I enjoy Go so much. It is almost perfect language for getting things done, but I still can't understand some design choices. Does someone knows why Go uses env
by ubavic 3y ago
I enjoy Go so much. It is almost perfect language for getting things done, but I still can't understand some design choices.
Does someone knows why Go uses env variables (like GOOS and GOARCH) instead command line arguments?
- superb_dev 3y agoIt could make it easier for build systems to be multi platform. You don’t have to keep track of custom args and add them to every call, you can just set the environment once.
- abalaji 3y agoI assume so that it can be sticky across invocations and is easy enough to debug using `go env`
- Cthulhu_ 3y agoI guess so you can configure them on e.g. a build server instead of tweak your build command, but then, neither is particularly portable.
- francislavoie 3y agoEnv vars make it easier to automate in CI. The actual script to build for each os/arch is the same but only the vars change. It's convenient. You can always prefix the command with the env vars on the same line if you want a one-liner.
- Patrickmi 3y agoAs a PL focused on building networking services across different arch and platforms if it was any different that’ll be the first thing to hate in go