Commit 7e12327a authored by xuweiwei's avatar xuweiwei Committed by GitHub

plugin/geoip: cleanup code (#5009)

remove unnecessary float64 convert and clean code
Signed-off-by: default avatarxuweiwei <xuweiwei_yewu@cmss.chinamobile.com>
parent eec4acdd
......@@ -39,11 +39,11 @@ func (g GeoIP) setCityMetadata(ctx context.Context, data *geoip2.City) {
return continentCode
})
latitude := strconv.FormatFloat(float64(data.Location.Latitude), 'f', -1, 64)
latitude := strconv.FormatFloat(data.Location.Latitude, 'f', -1, 64)
metadata.SetValueFunc(ctx, pluginName+"/latitude", func() string {
return latitude
})
longitude := strconv.FormatFloat(float64(data.Location.Longitude), 'f', -1, 64)
longitude := strconv.FormatFloat(data.Location.Longitude, 'f', -1, 64)
metadata.SetValueFunc(ctx, pluginName+"/longitude", func() string {
return longitude
})
......
......@@ -58,7 +58,7 @@ func newGeoIP(dbPath string) (*GeoIP, error) {
return nil, fmt.Errorf("unexpected failure looking up database %q schema %q: %v", filepath.Base(dbPath), schema.name, err)
}
} else {
db.provides = db.provides | schema.provides
db.provides |= schema.provides
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment