Skip to content

Commit e560941

Browse files
committed
Format and lint fixes
1 parent 2e5471c commit e560941

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

config/internal/configsource/manager.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ import (
6969
//
7070
// component:
7171
// config_field: |
72-
// $yamltemplate: /etc/component_template.yaml
73-
// logs_path: /var/logs/component.log
72+
// $yamltemplate: /etc/log_template.yaml
73+
// logs_path: /var/logs/
7474
// timeout: 10s
7575
//
7676
// Not all config sources need these optional parameters, they are used to provide extra control when
@@ -339,7 +339,7 @@ func parseCfgSrc(s string) (cfgSrcName, selector string, params interface{}, err
339339
const selectorDelim string = "?"
340340
parts = strings.SplitN(parts[1], selectorDelim, 2)
341341
selector = strings.Trim(parts[0], " ")
342-
342+
343343
if len(parts) == 2 {
344344
paramsPart := parts[1]
345345
params, err = parseParamsAsURLQuery(paramsPart)
@@ -367,7 +367,7 @@ func parseParamsAsURLQuery(s string) (interface{}, error) {
367367
params[k] = nil
368368
case 1:
369369
var iface interface{}
370-
if err := yaml.Unmarshal([]byte(v[0]), &iface); err != nil {
370+
if err = yaml.Unmarshal([]byte(v[0]), &iface); err != nil {
371371
return nil, err
372372
}
373373
params[k] = iface
@@ -376,7 +376,7 @@ func parseParamsAsURLQuery(s string) (interface{}, error) {
376376
elemSlice := make([]interface{}, 0, len(v))
377377
for _, elem := range v {
378378
var iface interface{}
379-
if err := yaml.Unmarshal([]byte(elem), &iface); err != nil {
379+
if err = yaml.Unmarshal([]byte(elem), &iface); err != nil {
380380
return nil, err
381381
}
382382
elemSlice = append(elemSlice, iface)

config/internal/configsource/manager_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func TestConfigSourceManager_ParamsHandling(t *testing.T) {
194194
Value: map[string]interface{}{
195195
"p0": true,
196196
"p1": "a string with spaces",
197-
"p2": map[string]interface{}{
197+
"p2": map[string]interface{}{
198198
"p2_0": "a nested map0",
199199
"p2_1": true,
200200
},
@@ -204,7 +204,7 @@ func TestConfigSourceManager_ParamsHandling(t *testing.T) {
204204
}
205205

206206
// Set OnRetrieve to check if the parameters were parsed as expected.
207-
tstCfgSrc.OnRetrieve = func (ctx context.Context, selector string, params interface{}) error {
207+
tstCfgSrc.OnRetrieve = func(ctx context.Context, selector string, params interface{}) error {
208208
assert.Equal(t, tstCfgSrc.ValueMap[selector].Value, params)
209209
return nil
210210
}
@@ -411,17 +411,17 @@ func Test_parseCfgSrc(t *testing.T) {
411411
},
412412
},
413413
{
414-
name: "empty_param",
415-
str: "cfgsrc:selector?no_closing=",
414+
name: "empty_param",
415+
str: "cfgsrc:selector?no_closing=",
416416
cfgSrcName: "cfgsrc",
417417
selector: "selector",
418418
params: map[string]interface{}{
419419
"no_closing": interface{}(nil),
420420
},
421421
},
422422
{
423-
name: "use_url_encode",
424-
str: "cfgsrc:selector?p0=contains+%3D+and+%26+too",
423+
name: "use_url_encode",
424+
str: "cfgsrc:selector?p0=contains+%3D+and+%26+too",
425425
cfgSrcName: "cfgsrc",
426426
selector: "selector",
427427
params: map[string]interface{}{

0 commit comments

Comments
 (0)