aboutsummaryrefslogtreecommitdiff
path: root/simpleconf.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-06-29 13:23:11 +0200
committerKevin Chabowski <kevin@kch42.de>2013-06-29 13:23:11 +0200
commit6b1d800927bd4505764fd56c659f211cb7bb25b5 (patch)
treed31ec20e37d475c3cc0548d59831ddb3d071a773 /simpleconf.go
parentaf9b3d79b6086e7f8c8ed5bc74753a806d5cddfa (diff)
downloadsimpleconf-6b1d800927bd4505764fd56c659f211cb7bb25b5.tar.gz
simpleconf-6b1d800927bd4505764fd56c659f211cb7bb25b5.tar.bz2
simpleconf-6b1d800927bd4505764fd56c659f211cb7bb25b5.zip
Test case added; fixed error (didn't save section name. D'oh!)
Diffstat (limited to 'simpleconf.go')
-rw-r--r--simpleconf.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/simpleconf.go b/simpleconf.go
index 777cd53..ad13f11 100644
--- a/simpleconf.go
+++ b/simpleconf.go
@@ -45,9 +45,13 @@ func Load(r io.Reader) (config Config, outerr error) {
if len(parts[1]) != 0 {
return nil, fmt.Errorf("More data after closing ']' at line %d", l)
}
+ if len(parts[0]) == 0 {
+ return nil, fmt.Errorf("Empty section name at line %d", l)
+ }
config.addSection(section, sectName)
section = make(Section)
+ sectName = parts[0]
default:
parts := strings.SplitN(line, "=", 2)
if len(parts) != 2 {