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 integer overflow lint errors #4227

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Fix integer overflow lint errors #4227

merged 1 commit into from
Aug 21, 2024

Conversation

dmjb
Copy link
Contributor

@dmjb dmjb commented Aug 21, 2024

The new version of golangci introduces integer overflow checks. A number of such issues were reported in Minder upon update.

Fixed through a mixture of type changes, explicit checks, and ignoring the linter in places where I was confident that we would never hit an overflow in practice.

Summary

Provide a brief overview of the changes and the issue being addressed.
Explain the rationale and any background necessary for understanding the changes.
List dependencies required by this change, if any.

Fixes #(related issue)

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@dmjb dmjb requested a review from a team as a code owner August 21, 2024 10:13
@dmjb dmjb force-pushed the fix-linting-overflow branch from 7490297 to 03fd692 Compare August 21, 2024 10:16
@@ -78,7 +79,13 @@ var (

func init() {
// Get the terminal width, if available, and set widths based on terminal width
w, _, err := term.GetSize(int(os.Stdout.Fd()))
fd := os.Stdout.Fd()
Copy link
Contributor Author

@dmjb dmjb Aug 21, 2024

Choose a reason for hiding this comment

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

Admittedly this check is kind of pedantic since the max FD limit is well under 2^31 on any OS I've heard of.

Copy link
Member

Choose a reason for hiding this comment

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

This is about getting the terminal width size which is used to format the CLI tables better, not the maximum amount of file descriptors on the OS

Copy link
Member

Choose a reason for hiding this comment

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

In that sense I don't think we should remove it

Copy link
Member

Choose a reason for hiding this comment

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

oh, I missed expanding this and responded solely on the comment that you added. You kept the width so my comment is obsolete then 👍

@dmjb dmjb force-pushed the fix-linting-overflow branch from 03fd692 to 059fd99 Compare August 21, 2024 10:21
Fixed through a mixture of type changes, and ignoring the linter in
places where I was confident that we would never hit an overflow in
practice.
@dmjb dmjb force-pushed the fix-linting-overflow branch from 059fd99 to 9caa758 Compare August 21, 2024 10:21
@coveralls
Copy link

coveralls commented Aug 21, 2024

Coverage Status

coverage: 53.77% (-0.002%) from 53.772%
when pulling 9caa758 on fix-linting-overflow
into a7d9023 on main.

@JAORMX JAORMX merged commit 7a0da06 into main Aug 21, 2024
22 checks passed
@JAORMX JAORMX deleted the fix-linting-overflow branch August 21, 2024 11:31
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.

5 participants