func intTag(f reflect.StructField, tag string, deflt int) (int, bool) { var err error var ret int64 v := f.Tag.Get(tag) if v == "" { return deflt, false } if ret, err = strconv.ParseInt(v, 10, 64); err != nil { logging.Panic("Invalid value for int: %s", v) } return int(ret), true }
func floatTag(f reflect.StructField, tag string, deflt float64) (float64, bool) { var err error var ret float64 v := f.Tag.Get(tag) if v == "" { return deflt, false } if ret, err = strconv.ParseFloat(v, 64); err != nil { logging.Panic("Invalid value for float: %s", v) } return ret, true }