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

[FEATURE] it's option to set case sensitive #1541

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Nothing-no
Copy link

anyway, I think it's better to offer user an option to choose case sensitive or not.

@CLAassistant
Copy link

CLAassistant commented Apr 15, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Nothing-no
❌ zhijian.chen


zhijian.chen seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link

👋 Thanks for contributing to Viper! You are awesome! 🎉

A maintainer will take a look at your pull request 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! ❤️

@Nothing-no
Copy link
Author

anyway, I think it's better to offer user an option to choose case sensitive or not.

add MapTo

  • source file
service:
    ip: 127.0.0.1
    port: 1234
version: 1.0.01
  • code
type Service struct {
	Port int `viper:"port"`
	IP string `viper:"ip"`
}
//your prepare code ...

var service Service
var version string

if err := viper.MapTo("service",&service); err != nil {
	//error handler...
}
if err := viper.MapTo("version",&version); err != nil {
	//error handler...
}



log.Println(service,version)

//....

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.

2 participants