Fix bug 3
This commit is contained in:
parent
4cea74d15d
commit
06ccb310d5
|
@ -15,7 +15,8 @@ active = false
|
||||||
|
|
||||||
[service-1]
|
[service-1]
|
||||||
port = 443
|
port = 443
|
||||||
url = http://%(host)s/something`
|
url = http://%(host)s/something
|
||||||
|
`
|
||||||
|
|
||||||
type stringtest struct {
|
type stringtest struct {
|
||||||
section string
|
section string
|
||||||
|
|
11
read.go
11
read.go
|
@ -49,11 +49,18 @@ func (c *ConfigFile) Read(reader io.Reader) (err os.Error) {
|
||||||
section = "default"
|
section = "default"
|
||||||
for {
|
for {
|
||||||
l, buferr := buf.ReadString('\n') // parse line-by-line
|
l, buferr := buf.ReadString('\n') // parse line-by-line
|
||||||
if buferr != nil && buferr != os.EOF {
|
l = strings.TrimSpace(l)
|
||||||
|
|
||||||
|
if buferr != nil {
|
||||||
|
if buferr != os.EOF {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
l = strings.TrimSpace(l)
|
if len(l) == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// switch written for readability (not performance)
|
// switch written for readability (not performance)
|
||||||
switch {
|
switch {
|
||||||
case len(l) == 0: // empty line
|
case len(l) == 0: // empty line
|
||||||
|
|
Loading…
Reference in New Issue