qinwenshi / goconf

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

Addition of GetInt64 #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I needed to be able to get an Int64 from the config file. So I simply copied 
the GetInt and made it return a int64:

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

        return value, err
}

Just wanted to submit this so it can make it into future releases.  -- Thanks!

Original issue reported on code.google.com by rma...@gmail.com on 13 Jul 2011 at 6:02