Skip to content

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

@GoHippo

Description

@GoHippo

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}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions