Chore/fix lint issues (#27704)
* Chore: Fix linting issues Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -68,7 +68,7 @@ func NewFileWriter() *FileLogWriter {
|
||||
Filename: "",
|
||||
Format: log15.LogfmtFormat(),
|
||||
Maxlines: 1000000,
|
||||
Maxsize: 1 << 28, //256 MB
|
||||
Maxsize: 1 << 28, // 256 MB
|
||||
Daily: true,
|
||||
Maxdays: 7,
|
||||
Rotate: true,
|
||||
|
||||
@@ -306,7 +306,7 @@ prefix.page.response.constname.constvalue.labelname.val2.count 1 1477043
|
||||
t.Fatalf("wanted \n%s\n, got \n%s\n", want, got)
|
||||
}
|
||||
|
||||
//next collect
|
||||
// next collect
|
||||
cntVec.WithLabelValues("val1").Inc()
|
||||
cntVec.WithLabelValues("val2").Inc()
|
||||
apicntVec.WithLabelValues("val1").Inc()
|
||||
@@ -373,7 +373,7 @@ func TestCounter(t *testing.T) {
|
||||
t.Fatalf("wanted \n%s\n, got \n%s\n", want, got)
|
||||
}
|
||||
|
||||
//next collect
|
||||
// next collect
|
||||
cntVec.Inc()
|
||||
|
||||
mfs, err = reg.Gather()
|
||||
|
||||
@@ -48,14 +48,14 @@ func (im *InternalMetricsService) parseGraphiteSettings() error {
|
||||
ErrorHandling: graphitebridge.ContinueOnError,
|
||||
}
|
||||
|
||||
safeInstanceName := strings.Replace(setting.InstanceName, ".", "_", -1)
|
||||
safeInstanceName := strings.ReplaceAll(setting.InstanceName, ".", "_")
|
||||
prefix := graphiteSection.Key("prefix").Value()
|
||||
|
||||
if prefix == "" {
|
||||
prefix = "prod.grafana.%(instance_name)s."
|
||||
}
|
||||
|
||||
bridgeCfg.Prefix = strings.Replace(prefix, "%(instance_name)s", safeInstanceName, -1)
|
||||
bridgeCfg.Prefix = strings.ReplaceAll(prefix, "%(instance_name)s", safeInstanceName)
|
||||
|
||||
im.graphiteCfg = bridgeCfg
|
||||
return nil
|
||||
|
||||
@@ -70,7 +70,7 @@ func (dc *databaseCache) Get(key string) (interface{}, error) {
|
||||
if cacheHit.Expires > 0 {
|
||||
existedButExpired := getTime().Unix()-cacheHit.CreatedAt >= cacheHit.Expires
|
||||
if existedButExpired {
|
||||
err = dc.Delete(key) //ignore this error since we will return `ErrCacheItemNotFound` anyway
|
||||
err = dc.Delete(key) // ignore this error since we will return `ErrCacheItemNotFound` anyway
|
||||
if err != nil {
|
||||
dc.log.Debug("Deletion of expired key failed: %v", err)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ func TestDatabaseStorageGarbageCollection(t *testing.T) {
|
||||
|
||||
obj := &CacheableStruct{String: "foolbar"}
|
||||
|
||||
//set time.now to 2 weeks ago
|
||||
// set time.now to 2 weeks ago
|
||||
var err error
|
||||
getTime = func() time.Time { return time.Now().AddDate(0, 0, -2) }
|
||||
err = db.Set("key1", obj, 1000*time.Second)
|
||||
@@ -39,10 +39,10 @@ func TestDatabaseStorageGarbageCollection(t *testing.T) {
|
||||
err = db.Set("key5", obj, 1000*time.Second)
|
||||
assert.Equal(t, err, nil)
|
||||
|
||||
//run GC
|
||||
// run GC
|
||||
db.internalRunGC()
|
||||
|
||||
//try to read values
|
||||
// try to read values
|
||||
_, err = db.Get("key1")
|
||||
assert.Equal(t, err, ErrCacheItemNotFound, "expected cache item not found. got: ", err)
|
||||
_, err = db.Get("key2")
|
||||
|
||||
@@ -79,7 +79,7 @@ func (ds *RemoteCache) Init() error {
|
||||
|
||||
// Run start the backend processes for cache clients
|
||||
func (ds *RemoteCache) Run(ctx context.Context) error {
|
||||
//create new interface if more clients need GC jobs
|
||||
// create new interface if more clients need GC jobs
|
||||
backgroundjob, ok := ds.client.(registry.BackgroundService)
|
||||
if ok {
|
||||
return backgroundjob.Run(ctx)
|
||||
|
||||
@@ -83,7 +83,7 @@ func canNotFetchExpiredItems(t *testing.T, client CacheStorage) {
|
||||
err := client.Set("key1", cacheableStruct, time.Second)
|
||||
assert.Equal(t, err, nil)
|
||||
|
||||
//not sure how this can be avoided when testing redis/memcached :/
|
||||
// not sure how this can be avoided when testing redis/memcached :/
|
||||
<-time.After(time.Second + time.Millisecond)
|
||||
|
||||
// should not be able to read that value since its expired
|
||||
|
||||
@@ -28,7 +28,7 @@ type UsageReport struct {
|
||||
}
|
||||
|
||||
func (uss *UsageStatsService) GetUsageReport() (UsageReport, error) {
|
||||
version := strings.Replace(setting.BuildVersion, ".", "_", -1)
|
||||
version := strings.ReplaceAll(setting.BuildVersion, ".", "_")
|
||||
|
||||
metrics := map[string]interface{}{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user