spf13 / spf13/cast

Replace errNegativeNotAllowed with overflow error

Open
#171 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
4k
Forks
337
Avg merge
15m
Merged PRs (30d)
1

Description

Technically, the following is valid:

var i int64 = -1
j := uint64(i)

The value will overflow, but the conversion happens.

We should replace the errNegativeNotAllowed error with one that signals that the conversion was successful, but an overflow occurred.

Combining this idea with #86, it might even make sense to have a single base error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating errNegativeNotAllowed and read issue #86 to understand the proposed shared error design. The work is done when negative-to-unsigned conversion reports overflow rather than rejection, with the relationship to the issue #86 error design resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.