Skip to content

Commit 9b036ad

Browse files
authored
Extract pdatagen as standalone tool/package (open-telemetry#13398)
Updates open-telemetry#12747 Removes one source of DCE disable which is the usage of text/template. Signed-off-by: Bogdan Drutu <[email protected]>
1 parent 2a3e63f commit 9b036ad

File tree

204 files changed

+239
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+239
-203
lines changed

.chloggen/rm-usage-templateds.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: pdata
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Remove usage of text/template from pdata, improves DCE.
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [12747]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [user]

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ genproto_sub:
246246

247247
# Generate structs, functions and tests for pdata package. Must be used after any changes
248248
# to proto and after running `make genproto`
249-
genpdata:
250-
pushd pdata/ && $(GOCMD) run ./internal/cmd/pdatagen/main.go && popd
251-
$(MAKE) fmt
249+
genpdata: $(PDATAGEN)
250+
$(PDATAGEN)
251+
$(MAKE) -C pdata fmt
252252

253253
INTERNAL_PROTO_SRC_DIRS := exporter/exporterhelper/internal/queue pdata/xpdata/request/internal
254254
INTERNAL_PROTO_FILES := $(foreach dir,$(INTERNAL_PROTO_SRC_DIRS),$(wildcard $(dir)/*.proto))

Makefile.Common

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ GOFUMPT := $(TOOLS_BIN_DIR)/gofumpt
3636
GOIMPORTS := $(TOOLS_BIN_DIR)/goimports
3737
GOVULNCHECK := $(TOOLS_BIN_DIR)/govulncheck
3838
LINT := $(TOOLS_BIN_DIR)/golangci-lint
39+
PDATAGEN := $(TOOLS_BIN_DIR)/pdatagen
3940
IMPI := $(TOOLS_BIN_DIR)/impi
4041
MISSPELL := $(TOOLS_BIN_DIR)/misspell
4142
MULTIMOD := $(TOOLS_BIN_DIR)/multimod

internal/cmd/pdatagen/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ../../../Makefile.Common

internal/cmd/pdatagen/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module go.opentelemetry.io/collector/internal/cmd/pdatagen
2+
3+
go 1.23.0

pdata/internal/cmd/pdatagen/internal/base_fields.go renamed to internal/cmd/pdatagen/internal/base_fields.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright The OpenTelemetry Authors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
4+
package internal // import "go.opentelemetry.io/collector/internal/cmd/pdatagen/internal"
55

66
import (
77
"strings"

pdata/internal/cmd/pdatagen/internal/base_slices.go renamed to internal/cmd/pdatagen/internal/base_slices.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright The OpenTelemetry Authors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
4+
package internal // import "go.opentelemetry.io/collector/internal/cmd/pdatagen/internal"
55

66
import (
77
"bytes"

pdata/internal/cmd/pdatagen/internal/base_structs.go renamed to internal/cmd/pdatagen/internal/base_structs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright The OpenTelemetry Authors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
4+
package internal // import "go.opentelemetry.io/collector/internal/cmd/pdatagen/internal"
55

66
type baseStruct interface {
77
getName() string

pdata/internal/cmd/pdatagen/internal/packages.go renamed to internal/cmd/pdatagen/internal/packages.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdata/internal/cmd/pdatagen/internal/pcommon_package.go renamed to internal/cmd/pdatagen/internal/pcommon_package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright The OpenTelemetry Authors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
4+
package internal // import "go.opentelemetry.io/collector/internal/cmd/pdatagen/internal"
55

66
var pcommon = &Package{
77
info: &PackageInfo{

0 commit comments

Comments
 (0)