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 log.Fatal() usage in encoder.go #207

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Conversation

h2570su
Copy link
Contributor

@h2570su h2570su commented Nov 9, 2023

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Go Version Update
  • Dependency Update

Description

Related Tickets & Documents

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Run verifications and test

  • make verify is passing
  • make test is passing

@h2570su h2570su changed the title Remove log.Fatal() uasge in encoder.go Remove log.Fatal() usage in encoder.go Nov 9, 2023
@AlexVulaj
Copy link
Member

Hi @h2570su , thanks for contributing! Could you provide a bit more information about why this change is necessary or what problems it solves?

@h2570su
Copy link
Contributor Author

h2570su commented Nov 13, 2023

log.Fatal() exits the program immediately.
In my opinion, that should been used only if the error is unrecoverable and critical enough.
And shouldn't been used in a library because a main program maybe using a different logger implementation, exiting program by std library logger could be hard to trace the location error occurred.

The encoder is returning error, the procedure encoder during reflection fails won't harms whole program.
Returning a error to top-level is enough.

Copy link
Member

@jaitaiwan jaitaiwan left a comment

Choose a reason for hiding this comment

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

This looks like a no brainer to me. I won't merge but I think it's pretty critical to merge it.

@jaitaiwan jaitaiwan merged commit 4890efc into gorilla:main Jan 18, 2024
2 checks passed
@jaitaiwan
Copy link
Member

Merged, Thanks for the contribution @h2570su!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants