chentao / gcfg

Automatically exported from code.google.com/p/gcfg
Other
0 stars 0 forks source link

Empty comment line causes the next line to be interpreted as comment #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 snabb@epipe.com on 23 Feb 2013 at 9:58

GoogleCodeExporter commented 9 years ago
This issue was closed by revision c63f4c380257.

Original comment by speter....@gmail.com on 24 Feb 2013 at 2:56

GoogleCodeExporter commented 9 years ago
Thanks for reporting.

Original comment by speter....@gmail.com on 24 Feb 2013 at 2:58