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
Closed
@aronatkins

Description

@aronatkins
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0