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