From 8f99c150c37d3f7ded1c13f1f5f52b60374632b6 Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Thu, 9 Jan 2025 15:56:26 -0500 Subject: [PATCH] Add linter rules to ensure we don't accidentally emit metrics directly instead of through the compat package (#633) --- .golangci-lint.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.golangci-lint.yml b/.golangci-lint.yml index 5f2a2d9f..654d05e1 100644 --- a/.golangci-lint.yml +++ b/.golangci-lint.yml @@ -9,6 +9,17 @@ linters-settings: check-shadowing: true golint: min-confidence: 0 + depguard: + rules: + main: + list-mode: lax + allow: + - "github.com/hashicorp/go-metrics/compat" + deny: + - pkg: "github.com/hashicorp/go-metrics" + desc: not allowed, use github.com/hashicorp/go-metrics/compat instead + - pkg: "github.com/armon/go-metrics" + desc: not allowed, use github.com/hashicorp/go-metrics/compat instead linters: disable-all: true @@ -16,6 +27,7 @@ linters: - gofmt #- golint - govet + - depguard #- varcheck #- typecheck #- gosimple