package webapi import ( . "reflect" "strconv" ) func valueToString(val Value) string { typ := val.Type() switch val.Kind() { case Int, Int8, Int16, Int32, Int64: return strconv.FormatInt(val.Int(), 10) case Uint, Uint8, Uint16, Uint32, Uint64, Uintptr: return strconv.FormatUint(val.Uint(), 10) case Float32, Float64: return strconv.FormatFloat(val.Float(), 'g', -1, 64) case String: return val.String() case Bool: if val.Bool() { return "true" } else { return "false" } default: panic("valueToString: can't print type " + typ.String()) } }