You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
88f8c10823
### Description This PR adds a `depguard` linter rule to [.golangci.yml](file:///Users/ijasahammed/Documents/open_source/opentelemetry-go/.golangci.yml) to enforce the use of the latest semantic convention version (`v1.40.0`). This rule ensures that: - Any new code importing `otel/semconv` must use `v1.40.0`. - The `semconv/` directory itself is excluded from this check to avoid linting legacy definitions. - The `zipkin exporter` is excluded from this check - Updated `semconv` version to v1.40.0 in the `sdk/log/logger_bench_test.go` test. ### Verification Results I verified this change locally using the following steps: 1. **Full Linter Run**: Ran `make precommit` (which executes `golangci-lint run`). It passed with **0 issues** across the entire repository. 2. **Smoke Test**: Added a temporary import of `go.opentelemetry.io/otel/semconv/v1.20.0` in trace.go. The linter correctly reported the violation: > `trace.go:7:2: import 'go.opentelemetry.io/otel/semconv/v1.20.0' is not allowed from list 'semconv': Use go.opentelemetry.io/otel/semconv/v1.40.0 instead. (depguard)` This change is not performance-critical and does not affect the library's runtime behavior. ### Checklist - [x] Signed CLA - [x] `make precommit` passes. - [x] CHANGELOG.md updated. (Not required) Fixes #7842 --------- Co-authored-by: Robert Pająk <pellared@hotmail.com> Co-authored-by: Damien Mathieu <42@dmathieu.com>