spf13 / spf13/cast

Unexpected number conversion

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

@eiffel-fl is already working on this.

Since Jul 18, 2024.

  • #219 by @eiffel-fl — open
Dominant language
Go
Stars
4k
Forks
337
Avg merge
15m
Merged PRs (30d)
1

Description

People are complaining about unexpected results when converting a string (usually prefixed with 0) to a number type.

The underlying strconv functions are called with 0 base which means it's trying to guess the base from the string.

There is a potential fix in #249, but we should probably document this better (and maybe add some tests/examples too).

Issues:

  • #74
  • #96
  • #112
  • #133
  • #147
  • #162
  • #182
  • #202
  • #214
  • #216
  • #220
  • #232
  • #228
  • #91
  • #152
  • #290
  • #228

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 reviewing the underlying strconv calls that use base 0, the proposed fix in pull request #249, and the related issues listed in the report. Done should include a decided behavior for strings with a leading 0, along with updated documentation and any agreed tests or examples.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.