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
|
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 {
|
metadata.SetValueFunc(ctx, pluginName+"/latitude", func() string {
|
||||||
return latitude
|
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 {
|
metadata.SetValueFunc(ctx, pluginName+"/longitude", func() string {
|
||||||
return longitude
|
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)
|
return nil, fmt.Errorf("unexpected failure looking up database %q schema %q: %v", filepath.Base(dbPath), schema.name, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
db.provides = db.provides | schema.provides
|
db.provides |= schema.provides
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue