melong007 / goconf

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

Fixed issues with compile #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
With the latest weekly build of Go I first ran gofix on all *.go files.  Next I 
had to edit the get.go and replace the GetFloat function with GetFloat32 and 
GetFloat64

// GetFloat32 has the same behaviour as GetString but converts the response to 
float.
func (c *ConfigFile) GetFloat64(section string, option string) (value float64, 
err os.Error) {
    sv, err := c.GetString(section, option)
    if err == nil {
        value, err = strconv.Atof64(sv)
        if err != nil {
            err = GetError{CouldNotParse, "float 64", sv, section, option}
        }
    }

    return value, err
}

// GetFloat64 has the same behaviour as GetString but converts the response to 
float.
func (c *ConfigFile) GetFloat32(section string, option string) (value float32, 
err os.Error) {
    sv, err := c.GetString(section, option)
    if err == nil {
        value, err = strconv.Atof32(sv)
        if err != nil {
            err = GetError{CouldNotParse, "float 32", sv, section, option}
        }
    }

    return value, err
}

goconf now compiles. -- Thanks for a very promising package for go!

Original issue reported on code.google.com by rma...@gmail.com on 30 May 2011 at 2:08

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

Original comment by step...@q5comm.com on 27 Jun 2011 at 3:04