From 80e8df06bf621875acfa09e57eda05decf99e6a6 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Nikolov Date: Wed, 24 Sep 2025 13:21:46 +0300 Subject: [PATCH 1/3] feat: migrate to tools directive See [1] for more details on the tools directive. [1]: https://go.dev/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module --- .github/workflows/build-and-test-arm.yml | 3 - .github/workflows/build-and-test.yml | 3 - .github/workflows/tidy-dependencies.yml | 3 - .gitignore | 2 - Makefile | 105 ++++++++++++----------- Makefile.Common | 91 ++++++++------------ cmd/builder/test/test.sh | 3 +- internal/buildscripts/compare-apidiff.sh | 7 +- internal/buildscripts/gen-apidiff.sh | 6 +- internal/tools/empty.go | 4 - internal/tools/go.mod | 62 +++++++------ internal/tools/go.sum | 2 - internal/tools/tools.go | 35 -------- 13 files changed, 137 insertions(+), 189 deletions(-) delete mode 100644 internal/tools/empty.go delete mode 100644 internal/tools/tools.go diff --git a/.github/workflows/build-and-test-arm.yml b/.github/workflows/build-and-test-arm.yml index 21872b4fc6c..6aa90253825 100644 --- a/.github/workflows/build-and-test-arm.yml +++ b/.github/workflows/build-and-test-arm.yml @@ -45,9 +45,6 @@ jobs: - name: Install dependencies if: steps.go-cache.outputs.cache-hit != 'true' run: make gomoddownload - - name: Install Tools - if: steps.go-cache.outputs.cache-hit != 'true' - run: make install-tools - name: Run Unit Tests run: make -j4 gotest arm-unittest: diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8b4ff41c654..68013bcef50 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -81,9 +81,6 @@ jobs: ~/go/bin ~/go/pkg/mod key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }} - - name: Install Tools - if: steps.go-cache.outputs.cache-hit != 'true' - run: make install-tools - name: Run `govulncheck` run: make govulncheck diff --git a/.github/workflows/tidy-dependencies.yml b/.github/workflows/tidy-dependencies.yml index 2e0d6fe5c51..111705bf82b 100644 --- a/.github/workflows/tidy-dependencies.yml +++ b/.github/workflows/tidy-dependencies.yml @@ -33,9 +33,6 @@ jobs: - name: Install dependencies if: steps.go-cache.outputs.cache-hit != 'true' run: make -j2 gomoddownload - - name: Install Tools - if: steps.go-cache.outputs.cache-hit != 'true' - run: make install-tools - name: go mod tidy run: | make gotidy diff --git a/.gitignore b/.gitignore index a2d22bb49fb..e70fa857c72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ bin/ dist/ -.tools/ /local # GoLand IDEA @@ -37,4 +36,3 @@ go.work* # npm (used for markdown-link-check) node_modules/* package-lock.json - diff --git a/Makefile b/Makefile index 1cdb58b4ddc..3ce7d1c98be 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,11 @@ ALL_DOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \ -type f | sort) # ALL_MODULES includes ./* dirs (excludes . dir) -ALL_MODULES := $(shell find . -type f -name "go.mod" -exec dirname {} \; | sort | grep -E '^./' ) +ALL_MODULES := $(shell find . -mindepth 2 \ + -type f \ + -name "go.mod" \ + -not -path "./internal/tools/*" \ + -exec dirname {} \; | sort ) CMD?= @@ -61,8 +65,8 @@ gotest-with-junit: @$(MAKE) for-all-target TARGET="test-with-junit" .PHONY: goporto -goporto: $(PORTO) - $(PORTO) -w --include-internal --skip-dirs "^cmd/mdatagen/third_party$$" ./ +goporto: + $(GO_TOOL) porto -w --include-internal --skip-dirs "^cmd/mdatagen/third_party$$" ./ .PHONY: for-all for-all: @@ -101,8 +105,8 @@ govulncheck: @$(MAKE) for-all-target TARGET="vulncheck" .PHONY: addlicense -addlicense: $(ADDLICENSE) - @ADDLICENSEOUT=`$(ADDLICENSE) -s=only -y "" -c "The OpenTelemetry Authors" $(ALL_SRC) 2>&1`; \ +addlicense: + @ADDLICENSEOUT=`$(GO_TOOL) addlicense -s=only -y "" -c "The OpenTelemetry Authors" $(ALL_SRC) 2>&1`; \ if [ "$$ADDLICENSEOUT" ]; then \ echo "$(ADDLICENSE) FAILED => add License errors:\n"; \ echo "$$ADDLICENSEOUT\n"; \ @@ -112,7 +116,7 @@ addlicense: $(ADDLICENSE) fi .PHONY: checklicense -checklicense: $(ADDLICENSE) +checklicense: @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*') ; do \ awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=3 { found=1; next } END { if (!found) print FILENAME }' $$f; \ awk '/SPDX-License-Identifier: Apache-2.0|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \ @@ -123,12 +127,12 @@ checklicense: $(ADDLICENSE) fi .PHONY: misspell -misspell: $(MISSPELL) - $(MISSPELL) -error $(ALL_DOC) +misspell: + $(GO_TOOL) misspell -error $(ALL_DOC) .PHONY: misspell-correction -misspell-correction: $(MISSPELL) - $(MISSPELL) -w $(ALL_DOC) +misspell-correction: + $(GO_TOOL) misspell -w $(ALL_DOC) .PHONY: run run: otelcorecol @@ -159,13 +163,13 @@ otelcorecol: pushd cmd/otelcorecol && CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/otelcorecol_$(GOOS)_$(GOARCH) -tags "grpcnotrace" ./... && popd .PHONY: genotelcorecol -genotelcorecol: install-tools +genotelcorecol: pushd cmd/builder/ && $(GOCMD) run ./ --skip-compilation --config ../otelcorecol/builder-config.yaml --output-path ../otelcorecol && popd $(MAKE) -C cmd/otelcorecol fmt .PHONY: actionlint -actionlint: $(ACTIONLINT) - $(ACTIONLINT) -config-file .github/actionlint.yaml -color .github/workflows/*.yml .github/workflows/*.yaml +actionlint: + $(GO_TOOL) actionlint -config-file .github/actionlint.yaml -color .github/workflows/*.yml .github/workflows/*.yaml .PHONY: ocb ocb: @@ -246,13 +250,10 @@ genproto_sub: @rm -rf $(OPENTELEMETRY_PROTO_SRC_DIR)/* @rm -rf $(OPENTELEMETRY_PROTO_SRC_DIR)/.* > /dev/null 2>&1 || true -remove-pdatagen: - rm -f .tools/pdatagen - # Generate structs, functions and tests for pdata package. Must be used after any changes # to proto and after running `make genproto` -genpdata: remove-pdatagen $(PDATAGEN) - $(PDATAGEN) +genpdata: + cd internal/cmd/pdatagen && $(GOCMD) run main.go -C $(SRC_ROOT) $(MAKE) -C pdata fmt INTERNAL_PROTO_SRC_DIRS := exporter/exporterhelper/internal/queue pdata/xpdata/request/internal @@ -321,17 +322,17 @@ certs-dryrun: @internal/buildscripts/gen-certs.sh -d .PHONY: checkapi -checkapi: $(CHECKAPI) - $(CHECKAPI) -folder . -config .checkapi.yaml +checkapi: + $(GO_TOOL) checkapi -folder . -config .checkapi.yaml # Verify existence of READMEs for components specified as default components in the collector. .PHONY: checkdoc -checkdoc: $(CHECKFILE) - $(CHECKFILE) --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME) --file-name "README.md" +checkdoc: + $(GO_TOOL) checkfile --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME) --file-name "README.md" # Construct new API state snapshots .PHONY: apidiff-build -apidiff-build: $(APIDIFF) +apidiff-build: @$(foreach pkg,$(ALL_PKGS),$(call exec-command,./internal/buildscripts/gen-apidiff.sh -p $(pkg))) # If we are running in CI, change input directory @@ -343,33 +344,33 @@ endif # Compare API state snapshots .PHONY: apidiff-compare -apidiff-compare: $(APIDIFF) +apidiff-compare: @$(foreach pkg,$(ALL_PKGS),$(call exec-command,./internal/buildscripts/compare-apidiff.sh -p $(pkg))) .PHONY: multimod-verify -multimod-verify: $(MULTIMOD) +multimod-verify: @echo "Validating versions.yaml" - $(MULTIMOD) verify + $(GO_TOOL) multimod verify MODSET?=stable .PHONY: multimod-prerelease -multimod-prerelease: $(MULTIMOD) - $(MULTIMOD) prerelease -s=true -b=false -v ./versions.yaml -m ${MODSET} +multimod-prerelease: + $(GO_TOOL) multimod prerelease -s=true -b=false -v ./versions.yaml -m ${MODSET} $(MAKE) gotidy COMMIT?=HEAD REMOTE?=git@github.com:open-telemetry/opentelemetry-collector.git .PHONY: push-tags -push-tags: $(MULTIMOD) - $(MULTIMOD) verify - set -e; for tag in `$(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} --print-tags | grep -v "Using" `; do \ +push-tags: + $(GO_TOOL) multimod verify + set -e; for tag in `$(GO_TOOL) multimod tag -m ${MODSET} -c ${COMMIT} --print-tags | grep -v "Using" `; do \ echo "pushing tag $${tag}"; \ git push ${REMOTE} $${tag}; \ done; .PHONY: check-changes -check-changes: $(MULTIMOD) - $(MULTIMOD) diff -p $(PREVIOUS_VERSION) -m $(MODSET) +check-changes: + $(GO_TOOL) multimod diff -p $(PREVIOUS_VERSION) -m $(MODSET) .PHONY: prepare-release prepare-release: @@ -429,29 +430,29 @@ checklinks: # error message "failed to sync logger: sync /dev/stderr: inappropriate ioctl for device" # is a known issue but does not affect function. .PHONY: crosslink -crosslink: $(CROSSLINK) +crosslink: @echo "Executing crosslink" - $(CROSSLINK) --root=$(shell pwd) --prune + $(GO_TOOL) crosslink --root=$(shell pwd) --prune FILENAME?=$(shell git branch --show-current) .PHONY: chlog-new -chlog-new: $(CHLOGGEN) - $(CHLOGGEN) new --config $(CHLOGGEN_CONFIG) --filename $(FILENAME) +chlog-new: + $(GO_TOOL) chloggen new --config $(CHLOGGEN_CONFIG) --filename $(FILENAME) .PHONY: chlog-validate -chlog-validate: $(CHLOGGEN) - $(CHLOGGEN) validate --config $(CHLOGGEN_CONFIG) +chlog-validate: + $(GO_TOOL) chloggen validate --config $(CHLOGGEN_CONFIG) .PHONY: chlog-preview -chlog-preview: $(CHLOGGEN) - $(CHLOGGEN) update --config $(CHLOGGEN_CONFIG) --dry +chlog-preview: + $(GO_TOOL) chloggen update --config $(CHLOGGEN_CONFIG) --dry .PHONY: chlog-update -chlog-update: $(CHLOGGEN) - $(CHLOGGEN) update --config $(CHLOGGEN_CONFIG) --version $(VERSION) +chlog-update: + $(GO_TOOL) chloggen update --config $(CHLOGGEN_CONFIG) --version $(VERSION) .PHONY: builder-integration-test -builder-integration-test: $(ENVSUBST) +builder-integration-test: cd ./cmd/builder && ./test/test.sh .PHONY: mdatagen-test @@ -462,20 +463,20 @@ mdatagen-test: cd cmd/mdatagen && $(GOCMD) test ./... .PHONY: generate-gh-issue-templates -generate-gh-issue-templates: $(GITHUBGEN) - $(GITHUBGEN) issue-templates +generate-gh-issue-templates: + $(GO_TOOL) githubgen issue-templates .PHONY: generate-codeowners -generate-codeowners: $(GITHUBGEN) - $(GITHUBGEN) --default-codeowner "open-telemetry/collector-approvers" -skipgithub codeowners +generate-codeowners: + $(GO_TOOL) githubgen --default-codeowner "open-telemetry/collector-approvers" -skipgithub codeowners .PHONY: gengithub -gengithub: $(GITHUBGEN) generate-codeowners generate-gh-issue-templates +gengithub: generate-codeowners generate-gh-issue-templates .PHONY: gendistributions -gendistributions: $(GITHUBGEN) - $(GITHUBGEN) distributions +gendistributions: + $(GO_TOOL) githubgen distributions .PHONY: generate-chloggen-components generate-chloggen-components: $(GITHUBGEN) - $(GITHUBGEN) chloggen-components + $(GO_TOOL) githubgen chloggen-components diff --git a/Makefile.Common b/Makefile.Common index 1f0369d7551..82fb89f9c40 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -17,68 +17,49 @@ GOTEST_OPT?= -timeout $(GOTEST_TIMEOUT) $(if $(and $(filter windows,$(GOOS)), $( SRC_ROOT := $(shell git rev-parse --show-toplevel) TOOLS_MOD_DIR := $(SRC_ROOT)/internal/tools -TOOLS_BIN_DIR := $(SRC_ROOT)/.tools -TOOLS_MOD_REGEX := "\s+_\s+\".*\"" -TOOLS_PKG_NAMES := $(shell grep -E $(TOOLS_MOD_REGEX) < $(TOOLS_MOD_DIR)/tools.go | tr -d " _\"" | grep -vE '/v[0-9]+$$') -TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_PKG_NAMES)))) +TOOLS_MOD_FILE := $(TOOLS_MOD_DIR)/go.mod +GO_TOOL := $(GOCMD) tool -modfile $(TOOLS_MOD_FILE) CHLOGGEN_CONFIG := .chloggen/config.yaml # no trailing slash JUNIT_OUT_DIR ?= $(TOOLS_MOD_DIR)/testresults -ACTIONLINT := $(TOOLS_BIN_DIR)/actionlint -ADDLICENSE := $(TOOLS_BIN_DIR)/addlicense -APIDIFF := $(TOOLS_BIN_DIR)/apidiff -CHECKAPI := $(TOOLS_BIN_DIR)/checkapi -CHECKFILE := $(TOOLS_BIN_DIR)/checkfile -CHLOGGEN := $(TOOLS_BIN_DIR)/chloggen -CROSSLINK := $(TOOLS_BIN_DIR)/crosslink -ENVSUBST := $(TOOLS_BIN_DIR)/envsubst -GITHUBGEN := $(TOOLS_BIN_DIR)/githubgen -GOFUMPT := $(TOOLS_BIN_DIR)/gofumpt -GOIMPORTS := $(TOOLS_BIN_DIR)/goimports -GOVULNCHECK := $(TOOLS_BIN_DIR)/govulncheck -LINT := $(TOOLS_BIN_DIR)/golangci-lint -PDATAGEN := $(TOOLS_BIN_DIR)/pdatagen -IMPI := $(TOOLS_BIN_DIR)/impi -MISSPELL := $(TOOLS_BIN_DIR)/misspell -MULTIMOD := $(TOOLS_BIN_DIR)/multimod -PORTO := $(TOOLS_BIN_DIR)/porto -GOTESTSUM := $(TOOLS_BIN_DIR)/gotestsum -MODERNIZE := $(TOOLS_BIN_DIR)/modernize - -.PHONY: install-tools -install-tools: $(TOOLS_BIN_NAMES) - -$(TOOLS_BIN_DIR): - mkdir -p $@ - -$(TOOLS_BIN_NAMES): $(TOOLS_BIN_DIR) $(TOOLS_MOD_DIR)/go.mod - cd $(TOOLS_MOD_DIR) && GOOS="" GOARCH="" $(GOCMD) build -o $@ -trimpath $(filter %/$(notdir $@),$(TOOLS_PKG_NAMES)) - .PHONY: test -test: $(GOTESTSUM) - $(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) +test: + $(GO_TOOL) gotestsum --packages="./..." -- $(GOTEST_OPT) .PHONY: test-with-cover -test-with-cover: $(GOTESTSUM) +test-with-cover: mkdir -p $(PWD)/coverage/unit - $(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) -cover -covermode=atomic -coverpkg $(COVER_PKGS) -args -test.gocoverdir="$(PWD)/coverage/unit" + $(GO_TOOL) gotestsum \ + --packages="./..." -- \ + $(GOTEST_OPT) -cover -covermode=atomic -coverpkg $(COVER_PKGS) -args -test.gocoverdir="$(PWD)/coverage/unit" .PHONY: test-with-junit -test-with-junit: $(GOTESTSUM) +test-with-junit: mkdir -p $(JUNIT_OUT_DIR) - $(GOTESTSUM) --packages="./..." --junitfile $(JUNIT_OUT_DIR)/$(CURR_MOD)-junit.xml -- $(GOTEST_OPT) ./... + $(GO_TOOL) gotestsum \ + --packages="./..." --junitfile $(JUNIT_OUT_DIR)/$(CURR_MOD)-junit.xml -- \ + $(GOTEST_OPT) ./... .PHONY: benchmark -benchmark: $(GOTESTSUM) - $(GOTESTSUM) --packages="$(ALL_PKGS)" -- -bench=. -run=notests ./... | tee benchmark.txt +benchmark: + $(GO_TOOL) gotestsum \ + --packages="$(ALL_PKGS)" -- \ + -bench=. -run=notests ./... | tee benchmark.txt .PHONY: fmt fmt: common/gofmt common/goimports common/gofumpt +# `modernize' cannot be installed as a Go tool via `go get -tool'. +# +# See [1] for more details. +# +# [1]: https://github.com/golang/go/issues/73279 .PHONY: modernize -modernize: $(MODERNIZE) - $(MODERNIZE) -fix -test -v ./... +modernize: + $(GOCMD) run \ + golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest \ + -fix -test -v ./... .PHONY: tidy tidy: @@ -86,32 +67,34 @@ tidy: $(GOCMD) mod tidy -compat=1.24.0 .PHONY: lint -lint: $(LINT) - $(LINT) run +lint: + $(GO_TOOL) golangci-lint run .PHONY: common/gofmt common/gofmt: gofmt -w -s ./ .PHONY: common/goimports -common/goimports: $(GOIMPORTS) - $(GOIMPORTS) -w -local go.opentelemetry.io/collector ./ +common/goimports: + $(GO_TOOL) goimports -w -local go.opentelemetry.io/collector ./ .PHONY: common/gofumpt -common/gofumpt: $(GOFUMPT) - $(GOFUMPT) -l -w -extra . +common/gofumpt: + $(GO_TOOL) gofumpt -l -w -extra . .PHONY: vulncheck -vulncheck: $(GOVULNCHECK) - $(GOVULNCHECK) ./... +vulncheck: + $(GO_TOOL) govulncheck ./... .PHONY: generate generate: $(GOCMD) generate ./... .PHONY: impi -impi: $(IMPI) - @$(IMPI) --local go.opentelemetry.io/collector --scheme stdThirdPartyLocal ./... +impi: + $(GO_TOOL) impi \ + --local go.opentelemetry.io/collector \ + --scheme stdThirdPartyLocal ./... .PHONY: moddownload moddownload: diff --git a/cmd/builder/test/test.sh b/cmd/builder/test/test.sh index de8c341f1f5..bd0591afd04 100755 --- a/cmd/builder/test/test.sh +++ b/cmd/builder/test/test.sh @@ -33,7 +33,8 @@ test_build_config() { echo "Starting test '${test}' at $(date)" >> "${out}/test.log" final_build_config=$(basename "${build_config}") - "${WORKSPACE_DIR}/.tools/envsubst" -o "${out}/${final_build_config}" -i <(cat "$build_config" "$replaces") + go tool -modfile "${WORKSPACE_DIR}/internal/tools/go.mod" envsubst \ + -o "${out}/${final_build_config}" -i <(cat "$build_config" "$replaces") if ! go run . --config "${out}/${final_build_config}" --output-path "${out}" > "${out}/builder.log" 2>&1; then echo "❌ FAIL ${test}. Failed to compile the test ${test}. Build logs:" cat "${out}/builder.log" diff --git a/internal/buildscripts/compare-apidiff.sh b/internal/buildscripts/compare-apidiff.sh index c474c4cd1b0..2f38c8a442c 100755 --- a/internal/buildscripts/compare-apidiff.sh +++ b/internal/buildscripts/compare-apidiff.sh @@ -17,11 +17,12 @@ usage() { package="" input_dir="./internal/data/apidiff" check_only=false -apidiff_cmd="$(git rev-parse --show-toplevel)/.tools/apidiff" +repo_toplevel="$( git rev-parse --show-toplevel )" +tools_mod_file="${repo_toplevel}/internal/tools/go.mod" while getopts "cp:d:" o; do case "${o}" in - c) + c) check_only=true ;; p) @@ -44,7 +45,7 @@ fi set -e if [ -e "$input_dir"/"$package"/apidiff.state ]; then - changes=$(${apidiff_cmd} "$input_dir"/"$package"/apidiff.state "$package") + changes=$(go tool -modfile "${tools_mod_file}" apidiff "$input_dir"/"$package"/apidiff.state "$package") if [ -n "$changes" ] && [ "$changes" != " " ]; then SUB='Incompatible changes:' if [ $check_only = true ] && [[ "$changes" =~ .*"$SUB".* ]]; then diff --git a/internal/buildscripts/gen-apidiff.sh b/internal/buildscripts/gen-apidiff.sh index 3cbbc19465e..3f66beb54c5 100755 --- a/internal/buildscripts/gen-apidiff.sh +++ b/internal/buildscripts/gen-apidiff.sh @@ -17,8 +17,8 @@ usage() { dry_run=false package="" output_dir="./internal/data/apidiff" -apidiff_cmd="$(git rev-parse --show-toplevel)/.tools/apidiff" - +repo_toplevel="$( git rev-parse --show-toplevel )" +tools_mod_file="${repo_toplevel}/internal/tools/go.mod" while getopts "dp:o:" o; do case "${o}" in @@ -60,7 +60,7 @@ trap clean_up EXIT mkdir -p "$tmp_dir/$package" -${apidiff_cmd} -w "$tmp_dir"/"$package"/apidiff.state "$package" +go tool -modfile "${tools_mod_file}" apidiff -w "$tmp_dir"/"$package"/apidiff.state "$package" # Copy files if not in dry-run mode. if [ $dry_run = false ]; then diff --git a/internal/tools/empty.go b/internal/tools/empty.go deleted file mode 100644 index 126de132bbd..00000000000 --- a/internal/tools/empty.go +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package tools // import "go.opentelemetry.io/collector/internal/tools" diff --git a/internal/tools/go.mod b/internal/tools/go.mod index b89e6f5961f..02189e283b4 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,28 +1,26 @@ module go.opentelemetry.io/collector/internal/tools -go 1.25 +go 1.24.0 -require ( - github.com/a8m/envsubst v1.4.3 - github.com/client9/misspell v0.3.4 - github.com/golangci/golangci-lint/v2 v2.5.0 - github.com/google/addlicense v1.2.0 - github.com/jcchavezs/porto v0.7.0 - github.com/pavius/impi v0.0.3 - github.com/rhysd/actionlint v1.7.7 - go.opentelemetry.io/build-tools/checkapi v0.26.2 - go.opentelemetry.io/build-tools/checkfile v0.26.2 - go.opentelemetry.io/build-tools/chloggen v0.26.2 - go.opentelemetry.io/build-tools/crosslink v0.26.2 - go.opentelemetry.io/build-tools/githubgen v0.26.2 - go.opentelemetry.io/build-tools/multimod v0.26.2 - go.opentelemetry.io/collector/internal/cmd/pdatagen v0.130.0 - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 - golang.org/x/tools v0.37.0 - golang.org/x/tools/gopls v0.0.0-20250922164505-4fb47d0de6dd - golang.org/x/vuln v1.1.4 - gotest.tools/gotestsum v1.13.0 - mvdan.cc/gofumpt v0.9.1 +tool ( + github.com/a8m/envsubst/cmd/envsubst + github.com/client9/misspell/cmd/misspell + github.com/golangci/golangci-lint/v2/cmd/golangci-lint + github.com/google/addlicense + github.com/jcchavezs/porto/cmd/porto + github.com/pavius/impi/cmd/impi + github.com/rhysd/actionlint/cmd/actionlint + go.opentelemetry.io/build-tools/checkapi + go.opentelemetry.io/build-tools/checkfile + go.opentelemetry.io/build-tools/chloggen + go.opentelemetry.io/build-tools/crosslink + go.opentelemetry.io/build-tools/githubgen + go.opentelemetry.io/build-tools/multimod + golang.org/x/exp/cmd/apidiff + golang.org/x/tools/cmd/goimports + golang.org/x/vuln/cmd/govulncheck + gotest.tools/gotestsum + mvdan.cc/gofumpt ) require ( @@ -46,6 +44,7 @@ require ( github.com/MirrexOne/unqueryvet v1.2.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect github.com/ProtonMail/go-crypto v1.3.0 // indirect + github.com/a8m/envsubst v1.4.3 // indirect github.com/alecthomas/chroma/v2 v2.20.0 // indirect github.com/alecthomas/go-check-sumtype v0.3.1 // indirect github.com/alexkohler/nakedret/v2 v2.0.6 // indirect @@ -77,6 +76,7 @@ require ( github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/ckaznocha/intrange v0.3.1 // indirect + github.com/client9/misspell v0.3.4 // indirect github.com/cloudflare/circl v1.6.1 // indirect github.com/curioswitch/go-reassign v0.3.0 // indirect github.com/cyphar/filepath-securejoin v0.4.1 // indirect @@ -115,6 +115,7 @@ require ( github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect github.com/golangci/go-printf-func-name v0.1.1 // indirect github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect + github.com/golangci/golangci-lint/v2 v2.5.0 // indirect github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95 // indirect github.com/golangci/misspell v0.7.0 // indirect github.com/golangci/nilerr v0.0.0-20250918000102-015671e622fe // indirect @@ -122,6 +123,7 @@ require ( github.com/golangci/revgrep v0.8.0 // indirect github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e // indirect github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect + github.com/google/addlicense v1.2.0 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/go-github/v74 v74.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect @@ -138,6 +140,7 @@ require ( github.com/hexops/gotextdiff v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/jcchavezs/porto v0.7.0 // indirect github.com/jgautheron/goconst v1.8.2 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jjti/go-spancheck v0.6.5 // indirect @@ -176,6 +179,7 @@ require ( github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.21.0 // indirect + github.com/pavius/impi v0.0.3 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pjbgf/sha1cd v0.4.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -190,6 +194,7 @@ require ( github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/raeperd/recvcheck v0.2.0 // indirect + github.com/rhysd/actionlint v1.7.7 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -239,11 +244,18 @@ require ( go.augendre.info/arangolint v0.2.0 // indirect go.augendre.info/fatcontext v0.8.1 // indirect go.opentelemetry.io/build-tools v0.26.2 // indirect + go.opentelemetry.io/build-tools/checkapi v0.26.2 // indirect + go.opentelemetry.io/build-tools/checkfile v0.26.2 // indirect + go.opentelemetry.io/build-tools/chloggen v0.26.2 // indirect + go.opentelemetry.io/build-tools/crosslink v0.26.2 // indirect + go.opentelemetry.io/build-tools/githubgen v0.26.2 // indirect + go.opentelemetry.io/build-tools/multimod v0.26.2 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect golang.org/x/crypto v0.42.0 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/exp/typeparams v0.0.0-20250911091902-df9299821621 // indirect golang.org/x/mod v0.28.0 // indirect golang.org/x/net v0.44.0 // indirect @@ -252,10 +264,14 @@ require ( golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect golang.org/x/term v0.35.0 // indirect golang.org/x/text v0.29.0 // indirect + golang.org/x/tools v0.37.0 // indirect + golang.org/x/vuln v1.1.4 // indirect google.golang.org/protobuf v1.36.8 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/gotestsum v1.13.0 // indirect honnef.co/go/tools v0.7.0-0.dev.0.20250523013057-bbc2f4dd71ea // indirect + mvdan.cc/gofumpt v0.9.1 // indirect mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 // indirect ) @@ -263,5 +279,3 @@ retract ( v0.57.1 // Release failed, use v0.57.2 v0.57.0 // Release failed, use v0.57.2 ) - -replace go.opentelemetry.io/collector/internal/cmd/pdatagen => ../cmd/pdatagen diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 0251632ed00..da3d5cf1a75 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -677,8 +677,6 @@ golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnps golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= -golang.org/x/tools/gopls v0.0.0-20250922164505-4fb47d0de6dd h1:NSMmYyAHZbX8ZEvgzmpnunTD+zr+GUdRz3XBXHJParY= -golang.org/x/tools/gopls v0.0.0-20250922164505-4fb47d0de6dd/go.mod h1:b8OzaGpoSBCEzowyWgBAb7xOOVl5vX0YubPo6hjtHiM= golang.org/x/vuln v1.1.4 h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I= golang.org/x/vuln v1.1.4/go.mod h1:F+45wmU18ym/ca5PLTPLsSzr2KppzswxPP603ldA67s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/tools/tools.go b/internal/tools/tools.go deleted file mode 100644 index 70155b31ad2..00000000000 --- a/internal/tools/tools.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -//go:build tools - -package tools // import "go.opentelemetry.io/collector/internal/tools" - -// This file follows the recommendation at -// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module -// on how to pin tooling dependencies to a go.mod file. -// This ensures that all systems use the same version of tools in addition to regular dependencies. - -import ( - _ "github.com/a8m/envsubst/cmd/envsubst" - _ "github.com/client9/misspell/cmd/misspell" - _ "github.com/golangci/golangci-lint/v2/cmd/golangci-lint" - _ "github.com/google/addlicense" - _ "github.com/jcchavezs/porto/cmd/porto" - _ "github.com/pavius/impi/cmd/impi" - _ "github.com/rhysd/actionlint/cmd/actionlint" - _ "go.opentelemetry.io/build-tools/checkapi" - _ "go.opentelemetry.io/build-tools/checkfile" - _ "go.opentelemetry.io/build-tools/chloggen" - _ "go.opentelemetry.io/build-tools/crosslink" - _ "go.opentelemetry.io/build-tools/githubgen" - _ "go.opentelemetry.io/build-tools/multimod" - _ "golang.org/x/exp/cmd/apidiff" - _ "golang.org/x/tools/cmd/goimports" - _ "golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize" - _ "golang.org/x/vuln/cmd/govulncheck" - _ "gotest.tools/gotestsum" - _ "mvdan.cc/gofumpt" - - _ "go.opentelemetry.io/collector/internal/cmd/pdatagen" -) From f9141fa08ae1bfdabadd94dafa80eae16bd63104 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Nikolov Date: Thu, 25 Sep 2025 15:49:18 +0300 Subject: [PATCH 2/3] renovate: enable `gomodTidy` post update option --- renovate.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/renovate.json b/renovate.json index f1d17f32f8a..d6eb38a6374 100644 --- a/renovate.json +++ b/renovate.json @@ -142,5 +142,8 @@ "prConcurrentLimit": 200, "suppressNotifications": [ "prEditedNotification" + ], + "postUpdateOptions": [ + "gomodTidy", ] } From ae3f125c357e4b1b77cdac126cc9f8ec6c18ac96 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Nikolov Date: Wed, 8 Oct 2025 11:03:06 +0300 Subject: [PATCH 3/3] cmd/otelcorecol: regenerate via `make genotelcorecol` --- cmd/otelcorecol/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index 3f25ddb0286..a8a9c35a1a3 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -4,7 +4,7 @@ module go.opentelemetry.io/collector/cmd/otelcorecol go 1.24.0 -toolchain go1.24.7 +toolchain go1.24.8 require ( go.opentelemetry.io/collector/component v1.43.0