diff --git a/cmd/mdatagen/package_test.go b/cmd/mdatagen/generated_package_test.go similarity index 60% rename from cmd/mdatagen/package_test.go rename to cmd/mdatagen/generated_package_test.go index 5cd502ca564..2a21d3c7c86 100644 --- a/cmd/mdatagen/package_test.go +++ b/cmd/mdatagen/generated_package_test.go @@ -1,5 +1,4 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 +// Code generated by mdatagen. DO NOT EDIT. package main diff --git a/cmd/mdatagen/main.go b/cmd/mdatagen/main.go index 959275c0226..ee4b719aef5 100644 --- a/cmd/mdatagen/main.go +++ b/cmd/mdatagen/main.go @@ -1,6 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +//go:generate mdatagen metadata.yaml + package main import ( @@ -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 { diff --git a/cmd/mdatagen/metadata.yaml b/cmd/mdatagen/metadata.yaml index 65bb097a962..bc18609e74c 100644 --- a/cmd/mdatagen/metadata.yaml +++ b/cmd/mdatagen/metadata.yaml @@ -2,5 +2,7 @@ type: mdatagen status: class: cmd + stability: + alpha: [metrics] codeowners: active: [dmitryax] \ No newline at end of file diff --git a/cmd/mdatagen/templates/package_test.go.tmpl b/cmd/mdatagen/templates/package_test.go.tmpl index f0e0ba2e795..93446b7a5d7 100644 --- a/cmd/mdatagen/templates/package_test.go.tmpl +++ b/cmd/mdatagen/templates/package_test.go.tmpl @@ -1,6 +1,6 @@ // Code generated by mdatagen. DO NOT EDIT. -package {{ .Package }} +package {{ if isCommand -}}main{{ else }}{{ .Package }}{{- end }} import ( "testing"