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

It changes the set 0 to the default value. #145

Open
GoHippo opened this issue Jul 4, 2024 · 0 comments
Open

It changes the set 0 to the default value. #145

GoHippo opened this issue Jul 4, 2024 · 0 comments

Comments

@GoHippo
Copy link

GoHippo commented Jul 4, 2024

conf.yaml :
num: 0

type Config struct {
	Num int `yaml:"num" env-default:"1"`
}

func main() {
	var conf Config
	if err := cleanenv.ReadConfig("conf.yaml", &conf); err != nil {
		log.Fatalf("Error reading config file: %v", err)
	}
	fmt.Printf("num:%v\n", conf)
}

result: "num:{1}"

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

No branches or pull requests

1 participant