Skip to content

Commit

Permalink
Add lint to check for known cross-module internal packages (#4426)
Browse files Browse the repository at this point in the history
* Add depguard conf for cross-mod internal pkg check

* Apply feedback

* Apply suggestions from code review

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
  • Loading branch information
MrAlias and pellared committed Aug 11, 2023
1 parent e9014a2 commit 7b9fb7a
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,56 @@ linters-settings:
- pkg: "crypto/md5"
- pkg: "crypto/sha1"
- pkg: "crypto/**/pkix"
otlp-internal:
files:
- "!**/exporters/otlp/internal/**/*.go"
# TODO: remove the following when otlpmetric/internal is removed.
- "!**/exporters/otlp/otlpmetric/internal/oconf/envconfig.go"
- "!**/exporters/otlp/otlpmetric/internal/oconf/options.go"
- "!**/exporters/otlp/otlpmetric/internal/oconf/options_test.go"
- "!**/exporters/otlp/otlpmetric/internal/otest/client_test.go"
deny:
- pkg: "go.opentelemetry.io/otel/exporters/otlp/internal"
desc: Do not use cross-module internal packages.
otlptrace-internal:
files:
- "!**/exporters/otlp/otlptrace/*.go"
- "!**/exporters/otlp/otlptrace/internal/**.go"
deny:
- pkg: "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal"
desc: Do not use cross-module internal packages.
otlpmetric-internal:
files:
- "!**/exporters/otlp/otlpmetric/internal/*.go"
- "!**/exporters/otlp/otlpmetric/internal/**/*.go"
deny:
- pkg: "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
desc: Do not use cross-module internal packages.
otel-internal:
files:
- "**/sdk/*.go"
- "**/sdk/**/*.go"
- "**/exporters/*.go"
- "**/exporters/**/*.go"
- "**/schema/*.go"
- "**/schema/**/*.go"
- "**/metric/*.go"
- "**/metric/**/*.go"
- "**/bridge/*.go"
- "**/bridge/**/*.go"
- "**/example/*.go"
- "**/example/**/*.go"
- "**/trace/*.go"
- "**/trace/**/*.go"
deny:
- pkg: "go.opentelemetry.io/otel/internal$"
desc: Do not use cross-module internal packages.
- pkg: "go.opentelemetry.io/otel/internal/attribute"
desc: Do not use cross-module internal packages.
- pkg: "go.opentelemetry.io/otel/internal/internaltest"
desc: Do not use cross-module internal packages.
- pkg: "go.opentelemetry.io/otel/internal/matchers"
desc: Do not use cross-module internal packages.
godot:
exclude:
# Exclude links.
Expand Down

0 comments on commit 7b9fb7a

Please sign in to comment.