istio.io/istio@v0.0.0-20240520182934-d79c90f27776/tools/golangci-override.yaml (about) 1 linters-settings: 2 depguard: 3 rules: 4 # deny for all go files 5 AllGoFiles: 6 files: 7 - $all 8 deny: 9 - pkg: golang.org/x/net/http2/h2c 10 desc: "h2c.NewHandler is unsafe; use wrapper istio.io/istio/pkg/h2c" 11 - pkg: github.com/golang/protobuf/jsonpb 12 desc: "don't use the jsonpb package directly; use util/protomarshal instead" 13 - pkg: google.golang.org/protobuf/encoding/protojson 14 desc: "don't use the protojson package directly; use util/protomarshal instead" 15 - pkg: gomodules.xyz/jsonpatch/v3 16 desc: "don't use v3; v2 is orders of magnitude higher performance" 17 - pkg: k8s.io/apimachinery/pkg/util/sets 18 desc: "use istio.io/istio/pkg/util/sets" 19 - pkg: k8s.io/utils/env 20 desc: "use istio.io/istio/pkg/env" 21 - pkg: k8s.io/utils/strings/slices 22 desc: "use istio.io/istio/pkg/slices" 23 - pkg: k8s.io/utils/pointer 24 desc: "use istio.io/istio/pkg/ptr" 25 - pkg: go.opencensus.io 26 desc: "do not use OpenCensus; use OpenTelemetry instead" 27 - pkg: golang.org/x/exp/maps 28 desc: "do not use golang.org/x/exp/maps; use istio.io/istio/pkg/maps instead" 29 - pkg: maps 30 desc: "do not use maps; use istio.io/istio/pkg/maps instead" 31 - pkg: golang.org/x/exp/slices 32 desc: "do not use golang.org/x/exp/slices; use istio.io/istio/pkg/slices instead" 33 - pkg: slices 34 desc: "do not use slices; use istio.io/istio/pkg/slices instead" 35 DenyOperatorAndIstioctl: 36 files: 37 # Tests can do anything 38 - "!$test" 39 # Main code should only be used by appropriate binaries 40 - "!**/operator/**" 41 - "!**/istioctl/**" 42 - "!**/tools/bug-report/**" 43 # This should only really import operator API, but that is hard to express without a larger refactoring 44 - "!**/pkg/kube/**" 45 - "!**/pkg/url/**" 46 - "!**/pkg/test/framework/**" 47 - "!**/tests/fuzz/**" 48 deny: 49 - pkg: istio.io/istio/operator 50 desc: "operator should not be imported" 51 - pkg: istio.io/istio/istioctl 52 desc: "istioctl should not be imported" 53 DenyOpenTelemetry: 54 files: 55 - $all 56 - "!**/pkg/monitoring/**" 57 - "!**/pkg/tracing/**" 58 deny: 59 - pkg: go.opentelemetry.io/otel 60 desc: "do not use OpenTelemetry directly; use pkg/monitoring" 61 - pkg: go.opentelemetry.io/otel/metric 62 desc: "do not use OpenTelemetry directly; use pkg/monitoring" 63 DenyProtobufV1: 64 files: 65 - $all 66 deny: 67 - pkg: github.com/golang/protobuf/ptypes 68 desc: "do not use github.com/golang/protobuf/ptypes; use google.golang.org/protobuf/types/known instead"