spf13 / viper

Go configuration with fangs
MIT License
27.01k stars 2.01k forks source link

long numeric value to string field in yaml files lose precision #1645

Open ccfish86 opened 1 year ago

ccfish86 commented 1 year ago

Preflight Checklist

Viper Version

1.16

Go Version

1.21

Config Source

Files

Format

YAML

Repl.it link

No response

Code reproducing the issue

// config.yaml
partner-key: 41647199611001163259761

// .go

type Express100 struct {
    PartnerKey string `mapstructure:"partner-key" json:"partner-key" yaml:"partner-key"` 

}


### Expected Behavior

PartnerKey  = 41647199611001163259761

### Actual Behavior

partner-key = 41647199611001160000000

### Steps To Reproduce

While I changed the config as follows,  it was resolved.(`PartnerKey  = 41647199611001163259761`)
// config.yaml
partner-key: "41647199611001163259761"

### Additional Information

It maybe then .yaml issue.

[An other issue](https://github.com/spf13/viper/issues)
github-actions[bot] commented 1 year ago

👋 Thanks for reporting!

A maintainer will take a look at your issue shortly. 👀

In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.

⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9

📣 If you've already given us your feedback, you can still help by spreading the news, either by sharing the above link or telling people about this on Twitter:

https://twitter.com/sagikazarmark/status/1306904078967074816

Thank you! ❤️