We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given the following toy.json:
toy.json
{ "options": { "foo": 0.4, "bar": 0.25 } }
and the following program:
package main import ( "fmt" "github.com/cristalhq/aconfig" ) func main() { var cfg struct { Options map[string]float64 } loader := aconfig.LoaderFor(&cfg, aconfig.Config{ Files: []string{"toy.json"}, }) err := loader.Load() fmt.Printf("%v\n%+v\n", err, cfg) }
I expect the program to print:
<nil> {Options:map[bar:0.25 foo:0.4]}
But instead, it prints:
aconfig: cannot load config: loading files: incorrect map value "0.25 foo:0.4]": strconv.ParseFloat: parsing "0.25 foo:0.4]": invalid syntax {Options:map[]}
The desired output is achieved if I replace toy.json with:
{ "options": "foo:0.4,bar:0.25" }
It would be much more convenient to be able to specify maps with the config language’s native map syntax.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Given the following
toy.json
:and the following program:
I expect the program to print:
But instead, it prints:
The desired output is achieved if I replace
toy.json
with:It would be much more convenient to be able to specify maps with the config language’s native map syntax.
The text was updated successfully, but these errors were encountered: