Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Don't use globals when handling CLI options #596

Open
invidian opened this issue Jun 9, 2020 · 0 comments
Open

Don't use globals when handling CLI options #596

invidian opened this issue Jun 9, 2020 · 0 comments
Labels
area/testing technical-debt Technical debt-related issues

Comments

@invidian
Copy link
Member

invidian commented Jun 9, 2020

Currently, we use methods like viper.AutomaticEnv(), which are global and may cause side-effects like #595.

Also globals should generally be avoided in Go: https://peter.bourgon.org/blog/2017/06/09/theory-of-modern-go.html, as they are difficult to test.

We should re-organize our code, which handles CLI to not use global options.

Ideally CLI code should only take care of reading arguments and flags from the user and pass them to Go structures, which can be then tested for specific behavior.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/testing technical-debt Technical debt-related issues
Projects
None yet
Development

No branches or pull requests

1 participant