chore: Fix linter findings for `revive:comment-spacings` (part 2) (#15897)
This commit is contained in:
parent
43590ca730
commit
453d32bd81
|
|
@ -30,7 +30,7 @@ type aliyunSdkClient interface {
|
||||||
ProcessCommonRequest(req *requests.CommonRequest) (response *responses.CommonResponse, err error)
|
ProcessCommonRequest(req *requests.CommonRequest) (response *responses.CommonResponse, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// discoveryTool is a object that provides discovery feature
|
// discoveryTool is an object that provides discovery feature
|
||||||
type discoveryTool struct {
|
type discoveryTool struct {
|
||||||
req map[string]discoveryRequest // Discovery request (specific per object type)
|
req map[string]discoveryRequest // Discovery request (specific per object type)
|
||||||
rateLimit int // Rate limit for API query, as it is limited by API backend
|
rateLimit int // Rate limit for API query, as it is limited by API backend
|
||||||
|
|
@ -39,7 +39,7 @@ type discoveryTool struct {
|
||||||
|
|
||||||
respRootKey string // Root key in JSON response where to look for discovery data
|
respRootKey string // Root key in JSON response where to look for discovery data
|
||||||
respObjectIDKey string // Key in element of array under root key, that stores object ID
|
respObjectIDKey string // Key in element of array under root key, that stores object ID
|
||||||
//for ,majority of cases it would be InstanceId, for OSS it is BucketName. This key is also used in dimension filtering// )
|
// for, the majority of cases it would be InstanceId, for OSS it is BucketName. This key is also used in dimension filtering
|
||||||
wg sync.WaitGroup // WG for primary discovery goroutine
|
wg sync.WaitGroup // WG for primary discovery goroutine
|
||||||
interval time.Duration // Discovery interval
|
interval time.Duration // Discovery interval
|
||||||
done chan bool // Done channel to stop primary discovery goroutine
|
done chan bool // Done channel to stop primary discovery goroutine
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
docker "github.com/docker/docker/client"
|
docker "github.com/docker/docker/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*This file is inherited from telegraf docker input plugin*/
|
// This file is inherited from telegraf docker input plugin
|
||||||
var (
|
var (
|
||||||
version = "1.24"
|
version = "1.24"
|
||||||
defaultHeaders = map[string]string{"User-Agent": "engine-api-cli-1.0"}
|
defaultHeaders = map[string]string{"User-Agent": "engine-api-cli-1.0"}
|
||||||
|
|
|
||||||
|
|
@ -491,7 +491,7 @@ func TestWriteLargeLine(t *testing.T) {
|
||||||
resp, err := http.Post(createURL(listener, "http", "/write", ""), "", bytes.NewBufferString(hugeMetricString+testMsgs))
|
resp, err := http.Post(createURL(listener, "http", "/write", ""), "", bytes.NewBufferString(hugeMetricString+testMsgs))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, resp.Body.Close())
|
require.NoError(t, resp.Body.Close())
|
||||||
//todo: with the new parser, long lines aren't a problem. Do we need to skip them?
|
// TODO: with the new parser, long lines aren't a problem. Do we need to skip them?
|
||||||
// require.EqualValues(t, 400, resp.StatusCode)
|
// require.EqualValues(t, 400, resp.StatusCode)
|
||||||
|
|
||||||
expected := testutil.MustMetric(
|
expected := testutil.MustMetric(
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ func TestWriteLargeLine(t *testing.T) {
|
||||||
resp, err := http.Post(createURL(listener, "http", "/api/v2/write", "bucket=mybucket"), "", bytes.NewBufferString(hugeMetricString+testMsgs))
|
resp, err := http.Post(createURL(listener, "http", "/api/v2/write", "bucket=mybucket"), "", bytes.NewBufferString(hugeMetricString+testMsgs))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, resp.Body.Close())
|
require.NoError(t, resp.Body.Close())
|
||||||
//todo: with the new parser, long lines aren't a problem. Do we need to skip them?
|
// TODO: with the new parser, long lines aren't a problem. Do we need to skip them?
|
||||||
// require.EqualValues(t, 400, resp.StatusCode)
|
// require.EqualValues(t, 400, resp.StatusCode)
|
||||||
|
|
||||||
expected := testutil.MustMetric(
|
expected := testutil.MustMetric(
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
/***
|
// The code contained here came from https://github.com/mongodb/mongo-tools/blob/master/mongostat/stat_types.go
|
||||||
The code contained here came from https://github.com/mongodb/mongo-tools/blob/master/mongostat/stat_types.go
|
// and contains modifications so that no other dependency from that project is needed. Other modifications included
|
||||||
and contains modifications so that no other dependency from that project is needed. Other modifications included
|
// removing unnecessary code specific to formatting the output and determine the current state of the database. It
|
||||||
removing unnecessary code specific to formatting the output and determine the current state of the database. It
|
// is licensed under Apache Version 2.0, http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
is licensed under Apache Version 2.0, http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
***/
|
|
||||||
|
|
||||||
package mongodb
|
package mongodb
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,9 +164,7 @@ func (n *NeptuneApex) parseXML(acc telegraf.Accumulator, data []byte) error {
|
||||||
if o.Xstatus != nil {
|
if o.Xstatus != nil {
|
||||||
fields["xstatus"] = *o.Xstatus
|
fields["xstatus"] = *o.Xstatus
|
||||||
}
|
}
|
||||||
// Try to determine outlet type. Focus on accuracy, leaving the
|
// Try to determine outlet type. Focus on accuracy, leaving the outlet_type "unknown" when ambiguous. 24v and vortech cannot be determined.
|
||||||
//outlet_type "unknown" when ambiguous. 24v and vortech cannot be
|
|
||||||
// determined.
|
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(o.DeviceID, "base_Var"):
|
case strings.HasPrefix(o.DeviceID, "base_Var"):
|
||||||
tags["output_type"] = "variable"
|
tags["output_type"] = "variable"
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,7 @@ func (pg *NativeFinder) UID(user string) ([]PID, error) {
|
||||||
for _, p := range procs {
|
for _, p := range procs {
|
||||||
username, err := p.Username()
|
username, err := p.Username()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//skip, this can happen if we don't have permissions or
|
// skip, this can be caused by the pid no longer exists, or you don't have permissions to access it
|
||||||
//the pid no longer exists
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if username == user {
|
if username == user {
|
||||||
|
|
@ -63,8 +62,7 @@ func (pg *NativeFinder) FullPattern(pattern string) ([]PID, error) {
|
||||||
for _, p := range procs {
|
for _, p := range procs {
|
||||||
cmd, err := p.Cmdline()
|
cmd, err := p.Cmdline()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//skip, this can be caused by the pid no longer existing
|
// skip, this can be caused by the pid no longer exists, or you don't have permissions to access it
|
||||||
//or you having no permissions to access it
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if regxPattern.MatchString(cmd) {
|
if regxPattern.MatchString(cmd) {
|
||||||
|
|
@ -122,8 +120,7 @@ func (pg *NativeFinder) Pattern(pattern string) ([]PID, error) {
|
||||||
for _, p := range procs {
|
for _, p := range procs {
|
||||||
name, err := processName(p)
|
name, err := processName(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//skip, this can be caused by the pid no longer existing
|
// skip, this can be caused by the pid no longer exists, or you don't have permissions to access it
|
||||||
//or you having no permissions to access it
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if regxPattern.MatchString(name) {
|
if regxPattern.MatchString(name) {
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ func TestMgrErrors(t *testing.T) {
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
require.Contains(t, err.Error(), testErrors[0].mgrConnectError.Error())
|
require.Contains(t, err.Error(), testErrors[0].mgrConnectError.Error())
|
||||||
|
|
||||||
////mgr.listServices error
|
// mgr.listServices error
|
||||||
winServices = &WinServices{
|
winServices = &WinServices{
|
||||||
Log: testutil.Logger{},
|
Log: testutil.Logger{},
|
||||||
mgrProvider: &FakeMgProvider{testErrors[1]},
|
mgrProvider: &FakeMgProvider{testErrors[1]},
|
||||||
|
|
@ -144,7 +144,7 @@ func TestMgrErrors(t *testing.T) {
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
require.Contains(t, err.Error(), testErrors[1].mgrListServicesError.Error())
|
require.Contains(t, err.Error(), testErrors[1].mgrListServicesError.Error())
|
||||||
|
|
||||||
////mgr.listServices error 2
|
// mgr.listServices error 2
|
||||||
winServices = &WinServices{
|
winServices = &WinServices{
|
||||||
Log: testutil.Logger{},
|
Log: testutil.Logger{},
|
||||||
ServiceNames: []string{"Fake service 1"},
|
ServiceNames: []string{"Fake service 1"},
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
//// Test data from distributed trace repo sample json
|
// Test data from distributed trace repo sample json
|
||||||
// https://github.com/mattkanwisher/distributedtrace/blob/master/testclient/sample.json
|
// https://github.com/mattkanwisher/distributedtrace/blob/master/testclient/sample.json
|
||||||
{
|
{
|
||||||
name: "distributed_trace_sample",
|
name: "distributed_trace_sample",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue