xv-tom-l / gcfg Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/gcfg
License: Other
Automatically exported from code.google.com/p/gcfg
License: Other
What steps will reproduce the problem?
1. For example try to parse a string "X" to field with type "int".
2. Observe the following error message:
failed to parse "X" as &reflect.commonType{size:0x4, hash:0xd5b87712, _:0x0,
align:0x4, fieldAlign:0x4, kind:0x87, alg:(*uintptr)(0x811eb8),
string:(*string)(0x69c548), uncommonType:(*reflect.uncommonType)(0x593950),
ptrToThis:(*reflect.runtimeType)(0x58bf70)}: parse error expected integer
What is the expected output? What do you see instead?
failed to parse "X" as uint: parse error expected integer
What version of the product are you using? On what operating system?
head
Please provide any additional information below.
A simple patch is attached.
Original issue reported on code.google.com by [email protected]
on 17 Feb 2013 at 7:06
Attachments:
What steps will reproduce the problem?
1. Add a field in a config Struct with the name `SomeKey`
2. Add the tag `gcfg:"some-key"` to the field
What is the expected output? What do you see instead?
Expect "some-key" in config to be filled in SomeKey, instead I get the error
invalid variable: section "foo" variable "some-key"
What I gather from the source code is that it *always* replaces dashes with
hyphens before anything else, so it is looking for a field `Some_Key` instead
of `SomeKey`, and is completely ignoring the tag I added to the field. So
instead the code should first look for a tag, and if and only if no tag exists,
replace dashes with underscores.
What version of the product are you using? On what operating system?
Go1.3.1 on CentOS 7 x64
Original issue reported on code.google.com by [email protected]
on 2 Nov 2014 at 7:32
trying out one example, below are my files at a particular location
#config.gcfg
[production]
db-host = 127.0.0.1
db-password = hahahah
#main.go
package main
import "fmt"
import "gcfg"
func main() {
var cfg Config
err := gcfg.ReadFileInto(&cfg, "config.gcfg")
fmt.Println(cfg)
}
# and the output with `import "gcfg"` is
main.go:4:8: import "gcfg": cannot find package
# and the output without `import "gcfg"` is
# command-line-arguments
./main.go:6: undefined: Config
./main.go:7: undefined: gcfg
Original issue reported on code.google.com by [email protected]
on 27 Mar 2013 at 1:47
It would be a nice feature if there was some way to get an array of pointers to
the subsections read in by any of the Read*Into functions. My use case has
subsections that are named but define parts of a pipeline which should be
configured differently based on the order that the subsections appear.
I.E.
# inputs will routed to the processor who's "match" pattern is true.
# Rules are processed in the order they appear.
[processor "a"]
match = foo.*
[processor "b"]
match = bar.*
[processor "default"]
match = .*
Original issue reported on code.google.com by [email protected]
on 25 Feb 2015 at 10:36
What steps will reproduce the problem?
1. Make a simple test program such as the following "test.go":
package main
import (
"code.google.com/p/gcfg"
"fmt"
)
var cfg struct {
Main struct {
Foo string
}
}
func main() {
err := gcfg.ReadFileInto(&cfg, "/tmp/test.cfg")
if err != nil {
fmt.Println(err)
} else {
fmt.Println("foo:", cfg.Main.Foo)
}
}
2. Make "/tmp/test.cfg" which consists of the following:
[main]
;
foo = bar
3. go run test.go
What is the expected output? What do you see instead?
Observe that the program outputs just "foo:".
The correct output is is "foo: bar" which is achieved if the empty comment line
is removed or any characters are added between the semicolon and the following
newline.
What version of the product are you using? On what operating system?
head
Original issue reported on code.google.com by [email protected]
on 23 Feb 2013 at 9:58
The `gitconfig` format supports multi-word variables and sections where each
word is seperated with `-`.
Do you plan such feature in gcfg? Here is how I imagine it:
[section-name]
variable-name = true
To be mapped to:
type Config struct {
SectionName struct {
VariableName bool
}
}
Original issue reported on code.google.com by [email protected]
on 22 Nov 2013 at 3:42
What steps will reproduce the problem?
1.Read the section of the docs that say "The mapping of each section or
variable name to fields is done either based on the "gcfg" struct tag or by
matching the name of the section or variable, ignoring case."
2.Attempt to find example which uses struct tags
3.open issue against project ;)
What is the expected output? What do you see instead?
Either the description of the feature should be verbose enough to make an
example unnecessary or an example should be present which clearly demonstrates
the feature.
Original issue reported on code.google.com by [email protected]
on 17 Dec 2014 at 7:21
Hi,
it would be really great if the package could support ":" type assignment as
e.g. python cfg is using.
Like:
"""
[foo]
bar: baz
"""
Attached is a patch with a test.
Thanks for your consideration,
Michael
Original issue reported on code.google.com by [email protected]
on 22 Jan 2015 at 3:25
Attachments:
Please consider supporting keys like "foo_bar", e.g.
"""
[section]
foo_bar=baz
"""
attached is a trivial patch that adds this.
Original issue reported on code.google.com by [email protected]
on 22 Jan 2015 at 4:17
Attachments:
good work by the way :)
I've got a project with a config file shared amongst several utilities, and
some test/work-in-progress settings. I'd really prefer it if the ReadInto
didn't fail completely if it finds a section in the file that doesn't match a
struct in the receiver.
I cloned the repo and:
- changed set.go line 30 to return nil
- reversed the test result requirement of line 137 in test_read.go
I'm not sure if I'll have to make further changes to ignore missing subsections
(I'm not using them yet)... my tests pass now :)
I don't know if this fits with your patterns, but now it just ignores any
entries in the config file that don't match a struct (silently at the moment,
but a stderr warning might be good)
It's not an 'issue' as such, so I won't be offended if you ignore this, keep up
the outstanding work!
Original issue reported on code.google.com by [email protected]
on 24 Oct 2013 at 10:47
i have a config layout that repeats like
[item]
name=foo
active=true
sleep=12
[item]
name=bar
active=false
sleep=49
so the struct layout i want is
[]Item {
name string
active bool
sleep int
}
but currently it wants
Item {
[]name string
[]active bool
[]sleep int
}
reason i want first layout is that way if the config say forgets a line then
the ordering could be broken if you
are expecting each item to be grouped
error with first is complaining about using a map or a struct so layout i want
at least with current error checking doesn't work
Original issue reported on code.google.com by [email protected]
on 30 Nov 2014 at 3:03
gcfg should support sections with all user-supplied variable names.
An equivalent example in gitconfig would be the [alias] section.
Original issue reported on code.google.com by [email protected]
on 11 May 2014 at 2:47
(Thanks for writing this module! Quite useful.)
The ability to _write_ configuration files is essential for most non-trivial
config files. As the complexity of clients increase, the ability to set
particular config values programmatically is more likely to be required.
It would also be very useful to provide a key lookup facility, in order to
implement get/sets like
`git config foo.bar`
`git config foo.bar baz`
Thanks!
[Opinionated aside: might get more contributions on github.]
Original issue reported on code.google.com by [email protected]
on 9 Jan 2014 at 12:30
When I try to install the package with: "go get code.google.com/p/gcfg"
I get this error:
../../../go/src/code.google.com/p/gcfg/go1_2.go:6:2: no buildable Go source
files in /usr/local/go/src/pkg/encoding
I'm using: "go version go1.2 linux/amd64"
Original issue reported on code.google.com by [email protected]
on 2 Apr 2014 at 3:09
Is there an official plan to migrate this repository to Github??
Original issue reported on code.google.com by [email protected]
on 17 Mar 2015 at 6:07
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.