plugin/geoip: cleanup code (#5009)
remove unnecessary float64 convert and clean code Signed-off-by: xuweiwei <xuweiwei_yewu@cmss.chinamobile.com>
This commit is contained in:
parent
eec4acdd96
commit
7e12327ab1
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue