From 74db4ec93df7bad8b90c666350aa4903f75c0a4a Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Fri, 17 Jan 2025 12:09:05 -0800 Subject: [PATCH] [chore][CODEOWNERS] Remove trailing whitespace (#37293) #### Description `githubgen` was adding trailing whitespaces to unmaintained components that was unnecessary. This removes the trailing whitespaces. #### Link to tracking issue Fixes #37292 --- .github/CODEOWNERS | 14 +++++++------- cmd/githubgen/codeowners.go | 10 ++++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d6a672701f54..68c81e80ce15 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -318,14 +318,14 @@ testbed/mockdatasenders/mockdatadogagentexporter/ @open-telemetry # List of distribution maintainers for OpenTelemetry Collector Contrib # ##################################################### -reports/distributions/core.yaml @open-telemetry/collector-contrib-approvers -reports/distributions/contrib.yaml @open-telemetry/collector-contrib-approvers -reports/distributions/k8s.yaml @open-telemetry/collector-contrib-approvers +reports/distributions/core.yaml @open-telemetry/collector-contrib-approvers +reports/distributions/contrib.yaml @open-telemetry/collector-contrib-approvers +reports/distributions/k8s.yaml @open-telemetry/collector-contrib-approvers ## UNMAINTAINED components -exporter/kineticaexporter/ @open-telemetry/collector-contrib-approvers -exporter/opensearchexporter/ @open-telemetry/collector-contrib-approvers -extension/observer/ecstaskobserver/ @open-telemetry/collector-contrib-approvers -extension/storage/filestorage/ @open-telemetry/collector-contrib-approvers +exporter/kineticaexporter/ @open-telemetry/collector-contrib-approvers +exporter/opensearchexporter/ @open-telemetry/collector-contrib-approvers +extension/observer/ecstaskobserver/ @open-telemetry/collector-contrib-approvers +extension/storage/filestorage/ @open-telemetry/collector-contrib-approvers diff --git a/cmd/githubgen/codeowners.go b/cmd/githubgen/codeowners.go index 615429be9c57..fd726743d7dc 100644 --- a/cmd/githubgen/codeowners.go +++ b/cmd/githubgen/codeowners.go @@ -139,7 +139,7 @@ LOOP: for stability := range m.Status.Stability { if stability == unmaintainedStatus { unmaintainedList += key + "/\n" - unmaintainedCodeowners += fmt.Sprintf("%s/%s @open-telemetry/collector-contrib-approvers \n", key, strings.Repeat(" ", data.maxLength-len(key))) + unmaintainedCodeowners += fmt.Sprintf("%s/%s @open-telemetry/collector-contrib-approvers\n", key, strings.Repeat(" ", data.maxLength-len(key))) continue LOOP } if stability == "deprecated" && (m.Status.Codeowners == nil || len(m.Status.Codeowners.Active) == 0) { @@ -176,7 +176,13 @@ LOOP: for _, m := range dist.Maintainers { maintainers = append(maintainers, fmt.Sprintf("@%s", m)) } - codeowners += fmt.Sprintf("reports/distributions/%s.yaml%s @open-telemetry/collector-contrib-approvers %s\n", dist.Name, strings.Repeat(" ", longestName-len(dist.Name)), strings.Join(maintainers, " ")) + + distribution := fmt.Sprintf("\nreports/distributions/%s.yaml%s @open-telemetry/collector-contrib-approvers", dist.Name, strings.Repeat(" ", longestName-len(dist.Name))) + if len(maintainers) > 0 { + distribution += fmt.Sprintf(" %s", strings.Join(maintainers, " ")) + } + + codeowners += distribution } err = os.WriteFile(filepath.Join(".github", "CODEOWNERS"), []byte(codeowners+unmaintainedCodeowners), 0o600)