can use getnumber instead of casting

This commit is contained in:
Ted Unangst 2020-09-10 15:04:29 -04:00
parent cd3f4eac24
commit 1b2394f95b
3 changed files with 7 additions and 5 deletions

View File

@ -830,8 +830,8 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
if tt == "Place" { if tt == "Place" {
p := new(Place) p := new(Place)
p.Name = name p.Name = name
p.Latitude, _ = tag["latitude"].(float64) p.Latitude, _ = tag.GetNumber("latitude")
p.Longitude, _ = tag["longitude"].(float64) p.Longitude, _ = tag.GetNumber("longitude")
p.Url, _ = tag.GetString("url") p.Url, _ = tag.GetString("url")
xonk.Place = p xonk.Place = p
} }
@ -861,8 +861,8 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
if tt, _ := loca.GetString("type"); tt == "Place" { if tt, _ := loca.GetString("type"); tt == "Place" {
p := new(Place) p := new(Place)
p.Name, _ = loca.GetString("name") p.Name, _ = loca.GetString("name")
p.Latitude, _ = loca["latitude"].(float64) p.Latitude, _ = loca.GetNumber("latitude")
p.Longitude, _ = loca["longitude"].(float64) p.Longitude, _ = loca.GetNumber("longitude")
p.Url, _ = loca.GetString("url") p.Url, _ = loca.GetString("url")
xonk.Place = p xonk.Place = p
} }

2
go.mod
View File

@ -9,5 +9,5 @@ require (
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 golang.org/x/net v0.0.0-20190620200207-3b0461eec859
humungus.tedunangst.com/r/go-sqlite3 v1.1.3 humungus.tedunangst.com/r/go-sqlite3 v1.1.3
humungus.tedunangst.com/r/webs v0.6.43 humungus.tedunangst.com/r/webs v0.6.44
) )

2
go.sum
View File

@ -24,3 +24,5 @@ humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M= humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M=
humungus.tedunangst.com/r/webs v0.6.43 h1:V7tmvzXi/LETO2QfHyqvIivi1kbjRSHQoDFcR3hML+k= humungus.tedunangst.com/r/webs v0.6.43 h1:V7tmvzXi/LETO2QfHyqvIivi1kbjRSHQoDFcR3hML+k=
humungus.tedunangst.com/r/webs v0.6.43/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps= humungus.tedunangst.com/r/webs v0.6.43/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
humungus.tedunangst.com/r/webs v0.6.44 h1:Y/Glxq/j8/AUXHl3cD82GbQ+6Cz3Y3CtvWsi/001w4Q=
humungus.tedunangst.com/r/webs v0.6.44/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=