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

Remove unnecessary variable declaration. #1581

Open
wants to merge 1 commit into
base: master
from

Conversation

@MorrisLaw
Copy link
Contributor

MorrisLaw commented Jul 20, 2020

We don't need the err variable declaration prior to initialization. Since err is not needed as a return value at the end of the function, I think that relying on Go's built-in type inference makes sense here.

@googlebot googlebot added the cla: yes label Jul 20, 2020
@codecov
Copy link

codecov bot commented Jul 20, 2020

Codecov Report

Merging #1581 into master will increase coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1581   +/-   ##
=======================================
  Coverage   67.95%   67.96%           
=======================================
  Files          96       96           
  Lines        8762     8761    -1     
=======================================
  Hits         5954     5954           
+ Misses       1898     1897    -1     
  Partials      910      910           
Impacted Files Coverage Δ
github/event.go 94.94% <0.00%> (+0.94%) ⬆️

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 e881974...cecbaea. Read the comment docs.

@MorrisLaw
Copy link
Contributor Author

MorrisLaw commented Jul 20, 2020

@gmlewis small refactor PR 😄

@@ -129,8 +129,7 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
// Deprecated: Use ParsePayload instead, which returns an error
// rather than panics if JSON unmarshaling raw payload fails.
func (e *Event) Payload() (payload interface{}) {
var err error
payload, err = e.ParsePayload()
payload, err := e.ParsePayload()

This comment has been minimized.

Copy link
@gmlewis

gmlewis Jul 20, 2020

Collaborator

If you're going to make this change, then you should also change line 131 and remove the named return variable because you just declared a new payload and they are no longer the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.