Skip to content

Commit d19ecd1

Browse files
mmorel-35Fiery-Fenix
authored andcommitted
[chore]: fix staticcheck rules (open-telemetry#39262)
#### Description Enable all rules from staticcheck from golangci-lint@v2 NB: cmd/otelcontribcol and cmd/oteltestbedcol don't need to be excluded as they don't contain any golang file. Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 27cc285 commit d19ecd1

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

.golangci.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ formatters:
77
exclusions:
88
paths:
99
- third_party
10-
- cmd/otelcontribcol
11-
- cmd/oteltestbedcol
1210

1311
settings:
1412
gci:
@@ -64,8 +62,6 @@ linters:
6462
# from this option's value (see exclude-dirs-use-default).
6563
paths:
6664
- third_party
67-
- cmd/otelcontribcol
68-
- cmd/oteltestbedcol
6965

7066
presets:
7167
- comments
@@ -212,20 +208,9 @@ linters:
212208
staticcheck:
213209
checks:
214210
- all
215-
- -QF1001 # FIXME
216-
- -QF1002 # FIXME
217-
- -QF1003 # FIXME
218-
- -QF1006 # FIXME
219-
- -QF1007 # FIXME
220-
- -QF1008 # FIXME
221-
- -QF1011 # FIXME
222-
- -QF1012 # FIXME
223-
- -ST1003 # FIXME
224-
- -ST1005 # FIXME
225-
- -ST1011 # FIXME
226-
- -ST1016 # FIXME
227-
- -ST1019 # FIXME
228-
- -ST1023 # FIXME
211+
- -ST1003 # FIXME: Poorly chosen identifier
212+
- -ST1005 # FIXME: Incorrectly formatted error string
213+
- -ST1011 # FIXME: Poorly chosen name for variable of type time.Duration
229214

230215
testifylint:
231216
disable:

extension/cgroupruntimeextension/integration_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,14 @@ func testServerECSMetadata(t *testing.T, containerCPU, taskCPU int) *httptest.Se
252252

253253
mux := http.NewServeMux()
254254
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
255-
_, err := w.Write([]byte(fmt.Sprintf(`{"Limits":{"CPU":%d},"DockerId":"container-id"}`, containerCPU)))
255+
_, err := fmt.Fprintf(w, `{"Limits":{"CPU":%d},"DockerId":"container-id"}`, containerCPU)
256256
assert.NoError(t, err)
257257
})
258258
mux.HandleFunc("/task", func(w http.ResponseWriter, _ *http.Request) {
259-
_, err := w.Write([]byte(fmt.Sprintf(
259+
_, err := fmt.Fprintf(w,
260260
`{"Containers":[{"DockerId":"container-id","Limits":{"CPU":%d}}],"Limits":{"CPU":%d}}`,
261261
containerCPU,
262-
taskCPU,
263-
)))
262+
taskCPU)
264263
assert.NoError(t, err)
265264
})
266265

receiver/awscontainerinsightreceiver/internal/host/ec2metadata.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ func (emd *ec2Metadata) refresh(ctx context.Context) {
7171
return
7272
}
7373

74-
emd.instanceID = resp.InstanceIdentityDocument.InstanceID
75-
emd.instanceType = resp.InstanceIdentityDocument.InstanceType
76-
emd.region = resp.InstanceIdentityDocument.Region
77-
emd.instanceIP = resp.InstanceIdentityDocument.PrivateIP
74+
emd.instanceID = resp.InstanceID
75+
emd.instanceType = resp.InstanceType
76+
emd.region = resp.Region
77+
emd.instanceIP = resp.PrivateIP
7878

7979
// notify ec2tags and ebsvolume that the instance id is ready
8080
if emd.instanceID != "" {

0 commit comments

Comments
 (0)