Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mdatagen] use main as package for cmd types #10130

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions cmd/mdatagen/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

//go:generate mdatagen metadata.yaml

package main

import (
Expand Down Expand Up @@ -204,6 +206,9 @@ func templatize(tmplFile string, md metadata) *template.Template {
"isConnector": func() bool {
return md.Status.Class == "connector"
},
"isCommand": func() bool {
return md.Status.Class == "cmd"
},
"supportsLogs": func() bool {
for _, signals := range md.Status.Stability {
for _, s := range signals {
Expand Down
2 changes: 2 additions & 0 deletions cmd/mdatagen/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ type: mdatagen

status:
class: cmd
stability:
alpha: [metrics]
codeowners:
active: [dmitryax]
2 changes: 1 addition & 1 deletion cmd/mdatagen/templates/package_test.go.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by mdatagen. DO NOT EDIT.

package {{ .Package }}
package {{ if isCommand -}}main{{ else }}{{ .Package }}{{- end }}

import (
"testing"
Expand Down
Loading