From 3980134186e7319122149a10085fd3742da3bb7b Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Wed, 3 Apr 2024 16:57:13 -0400 Subject: [PATCH] .golangci.yml- Disallow OSS -> x-pack dependencies According to LICENSE.txt, the Beats project uses both Apache 2.0 (OSS) and Elastic licenses. The OSS code may not depend on the Elastic License code otherwise the OSS-only binaries become tainted. This makes golangci-lint emit warnings for OSS code that depends on x-pack code. Closes #38719 --- .golangci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 4fd7b93f1b19..fc9f9e0fda0a 100755 --- a/.golangci.yml +++ b/.golangci.yml @@ -66,9 +66,19 @@ linters: - wastedassign # wastedassign finds wasted assignment statements. - gomodguard # check for blocked dependencies - prealloc # Finds slice declarations that could potentially be pre-allocated + - depguard # all available settings of specific linters linters-settings: + depguard: + rules: + apache-licensed-code: + list-mode: lax + files: + - '!**/x-pack/**/*.go' + deny: + - pkg: github.com/elastic/beats/v7/x-pack + desc: Apache 2.0 licensed code cannot depend on Elastic licensed code (x-pack/). errcheck: # report about not checking of errors in type assertions: `a := b.(MyStruct)`; check-type-assertions: false