Hi, I have type Product struct { Weight json.Number } func (p Product) GetWeight() float64 { tmp, _ := p.Weight.Float64() return tmp }
I would like to be able to call and assign the variable directly. I got the GetWeight() to help me convert from json.Number to float64. How to assign the variable? I would like to be able to use p Product &p.Weight Can some one help me or simplify the GetWeight also maybe? because right now I can only do it by: var tempWeight float32 assign using &tempWeight then p.Product = json.Number(fmt.Sprintf("%f", tempWeight)) Thank you. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e10dcacf-7445-48c6-88f0-90d9b72bfbafn%40googlegroups.com.