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

Fix type of EventInfo.PatchSet.Number #37

Merged
merged 1 commit into from
Jun 5, 2017
Merged

Conversation

opalmer
Copy link
Contributor

@opalmer opalmer commented Jun 5, 2017

Depending on the version of the events-log plugin
and the version of Gerrit you can end up in a situation
where some values of EventInfo.PatchSet.Number are a
string and other are an integer. This change works around
the problem by replacing the Number field with a custom
type that can handle either strings or integers.

Note, this does not change the underlying type of the
Number field.

Depending on the version of the events-log plugin
and the version of Gerrit you can end up in a situation
where some values of EventInfo.PatchSet.Number are a
string and other are an integer. This change works around
the problem by replacing the Number field with a custom
type that can handle either strings or integers.

Note, this does not change the underlying type of the
Number field.
@opalmer opalmer added the bug label Jun 5, 2017
@opalmer opalmer requested a review from andygrunwald June 5, 2017 18:33
@codecov-io
Copy link

codecov-io commented Jun 5, 2017

Codecov Report

Merging #37 into master will increase coverage by 0.6%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #37     +/-   ##
=========================================
+ Coverage   17.45%   18.06%   +0.6%     
=========================================
  Files          20       21      +1     
  Lines        1724     1738     +14     
=========================================
+ Hits          301      314     +13     
- Misses       1393     1394      +1     
  Partials       30       30
Impacted Files Coverage Δ
events.go 69.23% <ø> (ø) ⬆️
types.go 92.85% <92.85%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73dc271...16138b0. Read the comment docs.

@andygrunwald
Copy link
Owner

LGTM

@andygrunwald andygrunwald merged commit 2218433 into master Jun 5, 2017
@andygrunwald andygrunwald deleted the fix_patchset_number branch June 5, 2017 18:35
@opalmer
Copy link
Contributor Author

opalmer commented Jun 5, 2017

Thanks! I was really hoping there was a better way of handling this problem but I couldn't think of one. On the bright side, it's isolated to the plugin it seems and at least we'll have a way to deal with this if Gerrit itself has this kind of problem in the future.

On a side note, any objections to me cutting a new release?

@andygrunwald
Copy link
Owner

I often follow the principle: Make it work, make it beautiful, make it fast.
Your solution looks fine in my opinion and is simple to understand. This is one of the main points.

On a side note, any objections to me cutting a new release?

Go for it. Just prepare the release notes to show what has changed.

@opalmer
Copy link
Contributor Author

opalmer commented Jun 5, 2017

Go for it. Just prepare the release notes to show what has changed.

Will do, working on that now.

@opalmer opalmer modified the milestone: 0.3.0 Jun 5, 2017
"strconv"
)


Copy link
Collaborator

@dmitshur dmitshur Jun 18, 2017

Choose a reason for hiding this comment

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

This .go file isn't gofmted.

Copy link
Owner

Choose a reason for hiding this comment

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

@opalmer fixed / is fixing this in 5578108

*n = Number(strconv.Itoa(number))
return nil
}
return errors.New("Cannot convert data to number")
Copy link
Collaborator

@dmitshur dmitshur Jun 18, 2017

Choose a reason for hiding this comment

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

Style improvement suggestion, Go error strings should not be capitalized (unless beginning with proper nouns or acronyms).

See https://github.com/golang/go/wiki/CodeReviewComments#error-strings.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for this.
Fixed it in 2572c0e

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