Skip to content

Commit

Permalink
[chore] [mdatagen] Use directory name as package name for generated f…
Browse files Browse the repository at this point in the history
…iles (open-telemetry#31500)

Use the directory name for the package in generated files. Composing the
name doesn't match the reality for extensions.
  • Loading branch information
dmitryax authored Feb 29, 2024
1 parent 89c6207 commit 3cd5b15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/mdatagen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func run(ymlPath string) error {
}

ymlDir := filepath.Dir(ymlPath)
packageName := filepath.Base(ymlDir)

md, err := loadMetadata(ymlPath)
if err != nil {
Expand Down Expand Up @@ -75,7 +76,7 @@ func run(ymlPath string) error {

if md.Tests != nil {
if err = generateFile(filepath.Join(tmplDir, "component_test.go.tmpl"),
filepath.Join(ymlDir, "generated_component_test.go"), md, md.ShortFolderName+md.Status.Class); err != nil {
filepath.Join(ymlDir, "generated_component_test.go"), md, packageName); err != nil {
return err
}
}
Expand Down

0 comments on commit 3cd5b15

Please sign in to comment.