Commit 0b30861
Backport e2fe6b7 from #45521.
___
### What does this PR do?
Migrate the custom `pkgconfigusage` plugin for `golangci-lint` to an equivalent `depguard` rule, eliminating the need for rebuilding `golangci-lint` from downloaded sources.
Changes:
- migration of `pkgconfigusage` itself, from a `golangci-lint` plugin (#28382, #39367) to a rule for the depguard (v2) plugin, while preserving its name for traceability,
- move file exclusions to that rule configuration, while removing those that no longer exist or are no longer violating the rule:
- `comp/aggregator/demultiplexer/demultiplexerimpl/test_agent_demultiplexer.go`,
- `comp/core/agenttelemetry/impl/config.go`,
- `comp/core/config/config_mock.go`,
- `comp/core/workloadfilter/def/utils.go`,
- `comp/core/workloadmeta/collectors/internal/process/process_collector.go`,
- `comp/core/workloadmeta/collectors/util/process_util_linux.go`,
- `comp/dogstatsd/listeners/udp.go`,
- `comp/remote-config/rcservice/rcserviceimpl/rcservice.go`,
- `comp/remote-config/rcservicemrf/rcservicemrfimpl/rcservicemrf.go`,
- conversely move locally inhibited `// nolint:pkgconfigusage` to file exclusions:
- `comp/core/config/params.go`,
- `comp/core/workloadfilter/baseimpl/filter_utils.go`,
- `comp/core/workloadfilter/catalog/filter_config.go`,
- ~update `pkgconfigusage_test` to validate the effectiveness of the rule configuration defined in `.golangci.yml`,~
- remove custom `golangci-lint` build infrastructure.
### Motivation
This change kills several birds with one stone:
1. preparation step for the Go build migration to Bazel ([ABLD-317]): while looking for an isolated component with minimal dependencies to introduce the first Go toolchain as part of the ongoing Bazel migration, the custom `golangci-lint` build initially seemed to be a good candidate, but it turns out we can spare time by removing the said build at all,
2. standardization: the `golangci-lint` v2 upgrade (#43501) introduced `depguard` v2 support with file-based import restrictions using `glob` patterns, enabling the same architectural enforcement without a custom plugin,
3. reliability: the custom plugin build process obviously takes time and **occasionally failed in CI** and locally with:
```
Error: build process: clone golangci-lint: git clone --branch v2.7.0 --single-branch --depth 1 -c advice.detachedHead=false -q https://github.com/golangci/golangci-lint.git: exit status 128
```
([example CI log](https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/1369979128#L98))
[ABLD-317]: https://datadoghq.atlassian.net/browse/ABLD-317?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Co-authored-by: sabrina.lu <[email protected]>
1 parent bbd996d commit 0b30861
File tree
187 files changed
+132
-960
lines changed- .github
- .gitlab/.pre/deps_fetch
- comp
- api/api/def
- core
- agenttelemetry
- def
- fx
- impl
- configsync
- config
- flare
- builder
- types
- hostname/hostnameinterface
- ipc
- def
- httphelpers
- impl
- mock
- log
- def
- fx
- impl-trace
- impl
- mock
- secrets
- def
- fx
- impl
- mock
- noop-impl
- utils
- status
- statusimpl
- tagger
- def
- fx-remote
- generic_store
- impl-remote
- origindetection
- subscriber
- tags
- telemetry
- types
- utils
- telemetry
- workloadfilter
- baseimpl
- catalog
- def
- forwarder
- defaultforwarder
- orchestrator/orchestratorinterface
- logs/agent/config
- netflow/payload
- otelcol
- collector-contrib
- def
- impl
- converter
- def
- impl
- ddflareextension
- def
- impl
- types
- ddprofilingextension
- def
- impl
- logsagentpipeline
- logsagentpipelineimpl
- otlp
- components
- exporter
- datadogexporter
- logsagentexporter
- serializerexporter
- metricsclient
- processor/infraattributesprocessor
- testutil
- status
- def
- impl
- serializer
- logscompression
- metricscompression
- trace
- agent/def
- compression
- def
- impl-gzip
- impl-zstd
- pkg
- aggregator/ckey
- api
- collector/check/defaults
- config
- create
- env
- helper
- mock
- model
- nodetreemodel
- remote
- setup
- structure
- teeconfig
- utils
- viperconfig
- errors
- fips
- gohai
- linters
- components/pkgconfigusage
- testdata/src/comp
- logs
- client
- diagnostic
- message
- metrics
- pipeline
- processor
- sender
- sources
- status
- statusinterface
- utils
- types
- util/testutils
- metrics
- networkdevice/profile
- networkpath/payload
- network
- driver
- payload
- obfuscate
- opentelemetry-mapping-go
- inframetadata
- gohai/internal/gohaitest
- otlp
- attributes
- logs
- metrics
- rum
- orchestrator
- model
- util
- process/util/api
- proto
- remoteconfig/state
- security
- seclwin
- secl
- serializer
- ssi/testutils
- status/health
- tagger/types
- tagset
- telemetry
- trace
- log
- otel
- stats
- traceutil
- util
- backoff
- buf
- cache
- cgroups
- common
- compression
- containers/image
- defaultpaths
- executable
- filesystem
- flavor
- fxutil
- grpc
- hostinfo
- hostname/validate
- http
- jsonquery
- json
- kubernetes/apiserver/common/namespace
- log
- setup
- option
- otel
- pointer
- prometheus
- quantile
- sketchtest
- scrubber
- sort
- startstop
- statstracker
- system
- socket
- testutil
- utilizationtracker
- uuid
- winutil
- version
- tasks
- libs/common
- unit_tests/testdata
- test
- e2e-framework
- fakeintake
- new-e2e
- otel
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
187 files changed
+132
-960
lines changedThis file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
589 | 588 | | |
590 | 589 | | |
591 | 590 | | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | 591 | | |
596 | 592 | | |
597 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | 105 | | |
107 | 106 | | |
108 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
207 | 206 | | |
208 | 207 | | |
209 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | 175 | | |
177 | 176 | | |
178 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments