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

Cmd no globals #2353

Merged
merged 5 commits into from
Jan 28, 2022
Merged

Cmd no globals #2353

merged 5 commits into from
Jan 28, 2022

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Jan 26, 2022

edit: go commit by commit otherwise it's very hard to follow what happens IMO
edit2: I have optimized for small change so the code review can be done faster and also to not break anything. The final code is still pretty terrible for many ... many reasons, but fixing those is IMO outside the scope of this PR.

edit3: this was split so that the smaller changes are now in #2357 and #2358. And this PR is based on #2358 as it kind of depends on it to run the tests in parallel

@olegbespalov
Copy link
Contributor

A PR looks good 👍

However, I have a small readability improvement point. What if we use a more explicit name instead of the fl?

At some point, we (and other people) are going to read it again and ideally, we should limit the number of the shortcuts like that.

And sometimes it looks not consistent, example:

outputs, err := createOutputs(conf.Out, src, conf, runtimeOptions, executionPlan, osEnvironment, logger, fl)

@mstoykov
Copy link
Contributor Author

However, I have a small readability improvement point. What if we use a more explicit name instead of the fl?

as long as you come up with something. I guess part of the review process will be coming up with names about commandFlags and fl as both are ... bad.

Also I might break this in 3 PRs :

  1. the first commit here
  2. the last commit here without the paralization
  3. everything else - which IMO has the most to be discussed about

WDYT?

Comment on lines +88 to +91
configFilePath: os.Getenv("K6_CONFIG"), // Overridden by `-c`/`--config` flag!
exitOnRunning: os.Getenv("K6_EXIT_ON_RUNNING") != "",
showCloudLogs: true,
runType: os.Getenv("K6_TYPE"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of those os.Getenv should go, but as currently this are the only places where they are and there are zero tests covering this I decided against introducing even more changes.

codebien
codebien previously approved these changes Jan 26, 2022
Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an amount of code that I hope at some point will be rid by croconf, just spot one tiny typo

cmd/root.go Outdated
noColor bool
address string
)
// TODO better name - there are other commadn flags these are just ... non lib.Options ones :shrug:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO better name - there are other commadn flags these are just ... non lib.Options ones :shrug:
// TODO better name - there are other command flags these are just ... non lib.Options ones :shrug:

@mstoykov mstoykov changed the base branch from master to noGlobalLogrus January 28, 2022 10:02
@mstoykov
Copy link
Contributor Author

I've update the name and have split this in 3 PRs so this is only about the flags

olegbespalov
olegbespalov previously approved these changes Jan 28, 2022
Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, PR looks good to me! 💪

Base automatically changed from noGlobalLogrus to master January 28, 2022 12:56
@mstoykov
Copy link
Contributor Author

mstoykov commented Jan 28, 2022

Sorry for the delay

Don't worry, I actually will be waiting for @na-- to give a 👍 as well, as the person who probably is most familiar with all the things that can go wrong in this code

@mstoykov mstoykov added this to the v0.37.0 milestone Jan 28, 2022
na--
na-- previously approved these changes Jan 28, 2022
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, besides the minor nitpick for the comment! 🎉 This is definitely not the final state these should be in, but a great step in the right direction! ❤️

@mstoykov mstoykov dismissed stale reviews from na-- and olegbespalov via b547412 January 28, 2022 14:11
Co-authored-by: na-- <n@andreev.sh>
@mstoykov mstoykov merged commit e8f5360 into master Jan 28, 2022
@mstoykov mstoykov deleted the cmdNoGlobals branch January 28, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants