8000 include section/field in error · Issue #11 · go-gcfg/gcfg · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

include section/field in error #11

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

Closed
aronatkins opened this issue Aug 9, 2017 · 1 comment
Closed

include section/field in error #11

aronatkins opened this issue Aug 9, 2017 · 1 comment

Comments

@aronatkins
Copy link
package main

import (
	"fmt"

	"gopkg.in/gcfg.v1"
)

type Config struct {
	Settings struct {
		Enabled bool
	}
}

func main() {
	var config Config
	err := gcfg.ReadStringInto(&config, "[Settings]\nEnabled = xxx\n")
	fmt.Printf("read gave: %#v; %s\n", config, err)
}
$ go run parse.go
read gave: main.Config{Settings:struct { Enabled bool }{Enabled:false}}; failed to parse bool `xxx`

The error message should include information identifying the section and field that caused the error. In this case, maybe:

read gave: main.Config{Settings:struct { Enabled bool }{Enabled:false}}; failed to parse bool `xxx` into Settings.Enabled
@speter
Copy link
Contributor
speter commented Sep 6, 2017

Sorry for the delay. Very valid point. Will implement it shortly.

@speter speter closed this as completed in 298b7a6 Oct 13, 2017
peterebden pushed a commit to peterebden/gcfg that referenced this issue May 5, 2025
…g#11)

* Move file's comments to section if no sections when calling InjectField

* Preamble will be unrelated to what we're injecting so leave a gap
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

2 participants
0