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

Reduce redundant code #35

Merged
merged 2 commits into from
May 1, 2017
Merged

Reduce redundant code #35

merged 2 commits into from
May 1, 2017

Conversation

roclark
Copy link
Contributor

@roclark roclark commented May 1, 2017

No description provided.

Signed-Off-By: Robert Clark <robert.d.clark@hpe.com>
@roclark roclark requested a review from joehandzik May 1, 2017 19:59
jobs := jobRegex.FindAllString(jobStats, -1)
if len(jobs) == 0 {
jobs := regexCaptureStrings("(?ms:job_id:.*?(-|\\z))", jobStats)
if len(jobs) < 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

You're no longer returning nil, nil in cases where len(jobs) is equal to zero. Is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch, this was supposed to be

if len(jobs) < 1 {

Signed-Off-By: Robert Clark <robert.d.clark@hpe.com>
@joehandzik
Copy link
Contributor

@roclark I don't see any other issues. My only concern is sort of an overarching concern with the whole refactor...is it an issue that there are very few cases where you're returning an error struct (almost everything is nil, nil)? If that's intentional and you don't think it'll cause problems, feel free to merge when you're ready.

@roclark
Copy link
Contributor Author

roclark commented May 1, 2017

Due to the conversion of regexp.Compile to regexp.MustCompile, we shouldn't be getting any errors thrown by this code.

@roclark roclark merged commit f687370 into master May 1, 2017
@roclark roclark deleted the reduce-redundancies branch May 1, 2017 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants