Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Fix bug when deal with input value of uint. #483

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hustclf
Copy link

@hustclf hustclf commented Apr 6, 2023

hi, guys, there is a bug when parsing input unit value larger than 255.

here is a example to reproduce the bug.

package main

import (
	"github.com/AlecAivazis/survey/v2"
)

func main() {
	var max uint
	if err := survey.AskOne(&survey.Input{
		Message: "Which is the unit value?",
	}, &max); err != nil {
		panic(err)
	}
	print(max)
}

image

And we should set bitSize to 0 when calling parseUint, which means let the operating system determine the appropriate bitSize.

@AlecAivazis
Copy link
Owner

Awesome! Thanks for putting this together.

Do you mind adding a test that confirms the behavior?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants