├── .codespellignore ├── requirements.txt ├── checkapi ├── internal │ ├── badpkg │ │ └── receiver │ │ │ ├── badreceiver │ │ │ ├── go.sum │ │ │ ├── Makefile │ │ │ ├── metadata.yaml │ │ │ ├── go.mod │ │ │ └── code_test.go │ │ │ └── bad2receiver │ │ │ ├── Makefile │ │ │ ├── metadata.yaml │ │ │ ├── code_test.go │ │ │ └── go.mod │ ├── pkg │ │ ├── pkg │ │ │ ├── go.mod │ │ │ ├── metadata.yaml │ │ │ └── pkg.go │ │ ├── config_no_functions.yaml │ │ ├── config_any_functions.yaml │ │ ├── config_wrong_return_type.yaml │ │ ├── config_missing_function.yaml │ │ ├── config_only_one_allowed.yaml │ │ └── config_allowed.yaml │ ├── altpkg │ │ ├── receiver │ │ │ ├── altreceiver │ │ │ │ ├── Makefile │ │ │ │ ├── metadata.yaml │ │ │ │ ├── go.mod │ │ │ │ └── code_test.go │ │ │ └── badreceiver │ │ │ │ ├── Makefile │ │ │ │ ├── metadata.yaml │ │ │ │ ├── go.mod │ │ │ │ └── code_test.go │ │ └── config.yaml │ ├── config │ │ ├── receiver │ │ │ ├── configreceiver │ │ │ │ ├── Makefile │ │ │ │ ├── someothermodule │ │ │ │ │ ├── go.mod │ │ │ │ │ └── code_test.go │ │ │ │ ├── emb │ │ │ │ │ └── embedded.go │ │ │ │ ├── metadata.yaml │ │ │ │ ├── go.mod │ │ │ │ └── code_test.go │ │ │ ├── badconfigreceiver │ │ │ │ ├── Makefile │ │ │ │ ├── metadata.yaml │ │ │ │ ├── code_test.go │ │ │ │ └── go.mod │ │ │ └── configcallreceiver │ │ │ │ ├── Makefile │ │ │ │ ├── metadata.yaml │ │ │ │ ├── go.mod │ │ │ │ └── code_test.go │ │ └── config.yaml │ ├── testpkg │ │ └── receiver │ │ │ └── validreceiver │ │ │ ├── Makefile │ │ │ ├── metadata.yaml │ │ │ ├── code_test.go │ │ │ └── go.mod │ ├── unkeyedpkg │ │ └── receiver │ │ │ └── unkeyedreceiver │ │ │ ├── Makefile │ │ │ ├── metadata.yaml │ │ │ ├── ignored_test.go │ │ │ ├── internal │ │ │ └── internal.go │ │ │ ├── code_test.go │ │ │ └── go.mod │ ├── metadata.go │ └── jsonschema_test.go ├── metadata.yaml ├── go.mod ├── README.md ├── config.yaml └── main_windows_test.go ├── dbotconf ├── internal │ ├── testdata │ │ ├── invalid.yml │ │ └── dependabot.yml │ ├── conf.go │ └── cmd.go ├── go.mod ├── main.go └── README.md ├── issuegenerator ├── README.md ├── testdata │ └── junit │ │ ├── package1-junit.xml │ │ ├── package2-junit.xml │ │ └── package3-junit.xml ├── go.mod └── internal │ └── report │ └── report.go ├── .gitattributes ├── crosslink ├── internal │ ├── mock_test_data │ │ ├── testWork │ │ │ ├── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ └── go.work │ │ ├── testExclude │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ └── gomod │ │ ├── testSimple │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ └── gomod │ │ ├── testSkip │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ └── gomod │ │ ├── testTidyListAcyclic │ │ │ ├── gomod │ │ │ ├── testC │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ └── testB │ │ │ │ └── gomod │ │ ├── testTidyListCyclic │ │ │ ├── gomod │ │ │ ├── testC │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ ├── allow-circular.txt │ │ │ ├── allow-circular-overpermissive.txt │ │ │ └── testB │ │ │ │ └── gomod │ │ ├── testTidyListOrder │ │ │ ├── gomod │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ ├── testC │ │ │ │ └── gomod │ │ │ └── testA │ │ │ │ └── gomod │ │ ├── testNoOverwrite │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ └── gomod │ │ ├── testOverwrite │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ └── gomod │ │ ├── testSimplePrune │ │ │ ├── testB │ │ │ │ └── gomod │ │ │ ├── testA │ │ │ │ └── gomod │ │ │ └── gomod │ │ └── testCyclic │ │ │ ├── gomod │ │ │ ├── testB │ │ │ └── gomod │ │ │ └── testA │ │ │ └── gomod │ ├── test_data │ │ └── .placeholder │ └── config.go ├── go.mod └── main.go ├── .markdownlint.yaml ├── dependencies.Dockerfile ├── multimod ├── internal │ ├── shared │ │ ├── sharedtest │ │ │ ├── test_data │ │ │ │ └── README.md │ │ │ ├── doc.go │ │ │ └── sharedtest_test.go │ │ ├── doc.go │ │ ├── test_data │ │ │ ├── new_module_set_release │ │ │ │ ├── versions_invalid_syntax.yaml │ │ │ │ └── versions_valid.yaml │ │ │ ├── new_module_versioning │ │ │ │ ├── versions_invalid_syntax.yaml │ │ │ │ └── versions_valid.yaml │ │ │ ├── read_versioning_filename │ │ │ │ ├── versions_invalid_syntax.yaml │ │ │ │ └── versions_valid.yaml │ │ │ ├── verify_git_tags_do_not_already_exist │ │ │ │ ├── versions_invalid_syntax.yaml │ │ │ │ └── versions_valid.yaml │ │ │ └── alt_version_files │ │ │ │ └── versions.yaml │ │ ├── all_mod.go │ │ └── errors.go │ ├── verify │ │ ├── doc.go │ │ └── test_data │ │ │ ├── get_dependencies │ │ │ ├── versions_invalid_syntax.yaml │ │ │ └── versions_valid.yaml │ │ │ ├── new_verification │ │ │ ├── versions_invalid_syntax.yaml │ │ │ └── versions_valid.yaml │ │ │ ├── verify_all_modules_in_set │ │ │ ├── module_not_listed.yaml │ │ │ ├── module_not_in_repo.yaml │ │ │ └── versions_valid.yaml │ │ │ ├── verify_versions │ │ │ ├── versions_valid.yaml │ │ │ ├── invalid_version.yaml │ │ │ └── multiple_sets_same_major.yaml │ │ │ └── verify_dependencies │ │ │ └── versions_valid.yaml │ ├── tag │ │ ├── doc.go │ │ ├── test_data │ │ │ ├── new_tagger │ │ │ │ ├── versions_invalid_syntax.yaml │ │ │ │ └── versions_valid.yaml │ │ │ ├── delete_module_set_tags │ │ │ │ └── versions_valid.yaml │ │ │ └── tag_all_modules │ │ │ │ └── versions_valid.yaml │ │ └── errors.go │ ├── sync │ │ ├── doc.go │ │ └── test_data │ │ │ ├── new_sync │ │ │ ├── other_versions_valid.yaml │ │ │ └── versions_valid.yaml │ │ │ ├── update_all_go_mod_files │ │ │ ├── other_versions_valid.yaml │ │ │ └── versions_valid.yaml │ │ │ └── update_all_go_mod_files_with_commit_hash │ │ │ ├── other_versions_valid.yaml │ │ │ └── versions_valid.yaml │ └── prerelease │ │ ├── doc.go │ │ └── test_data │ │ ├── new_prerelease │ │ ├── versions_invalid_syntax.yaml │ │ └── versions_valid.yaml │ │ ├── update_all │ │ └── versions.yaml │ │ ├── update_all_version_go │ │ └── versions_valid.yaml │ │ └── update_all_go_mod_files │ │ └── versions_valid.yaml ├── main.go └── cmd │ ├── verify.go │ ├── diff.go │ └── root.go ├── githubgen ├── testdata │ └── chloggen_components │ │ └── .chloggen │ │ └── config.yaml ├── go.mod ├── constants.go ├── chloggencomponents.go ├── README.md ├── issuetemplates_test.go └── datatype │ └── fake │ └── mock_generator.go ├── checkfile ├── go.mod ├── README.md ├── go.sum └── main.go ├── .codespellrc ├── gotmpl ├── go.mod ├── testdata │ ├── want.go │ └── in.go.tmpl ├── README.md ├── go.sum ├── main.go └── gotmpl.go ├── chloggen ├── internal │ ├── chlog │ │ ├── testdata │ │ │ ├── CHANGELOG_custom │ │ │ ├── CHANGELOG │ │ │ └── custom.tmpl │ │ ├── TEMPLATE.yaml │ │ └── summary.tmpl │ └── config │ │ └── config.yaml ├── go.mod ├── README.md ├── cmd │ ├── testdata │ │ ├── CHANGELOG.md │ │ ├── dry_run │ │ │ └── CHANGELOG.md │ │ ├── filter_component_no_match │ │ │ └── CHANGELOG.md │ │ ├── bug_fix_only │ │ │ └── CHANGELOG.md │ │ ├── deprecation_only │ │ │ └── CHANGELOG.md │ │ ├── enhancement_only │ │ │ └── CHANGELOG.md │ │ ├── new_component_only │ │ │ └── CHANGELOG.md │ │ ├── breaking_only │ │ │ └── CHANGELOG.md │ │ ├── filter_component │ │ │ └── CHANGELOG.md │ │ ├── .chloggen │ │ │ └── TEMPLATE.yaml │ │ ├── subtext │ │ │ └── CHANGELOG.md │ │ ├── all_change_types_alphabetical │ │ │ └── CHANGELOG.md │ │ ├── all_change_types │ │ │ └── CHANGELOG.md │ │ ├── multiple_changelogs │ │ │ ├── CHANGELOG.md │ │ │ └── CHANGELOG-API.md │ │ ├── multiple_changelogs_single_default │ │ │ ├── CHANGELOG.md │ │ │ └── CHANGELOG-API.md │ │ ├── multiple_changelogs_multiple_defaults │ │ │ ├── CHANGELOG.md │ │ │ └── CHANGELOG-API.md │ │ └── all_change_types_multiple │ │ │ └── CHANGELOG.md │ ├── validate.go │ ├── root_test.go │ ├── new.go │ └── root.go ├── main.go └── go.sum ├── .gitignore ├── .github ├── workflows │ ├── check_links_config.json │ ├── fossa.yml │ ├── gosec.yml │ ├── codeql-analysis.yml │ ├── ossf-scorecard.yml │ └── markdown.yml ├── CODEOWNERS └── ISSUE_TEMPLATE │ ├── enhancement.yml │ └── bug_report.yml ├── go.mod ├── .chloggen ├── TEMPLATE.yaml └── fix-tidylist-validate.yaml ├── internal ├── tools │ └── tools.go └── syncerror │ ├── known_sync_error_windows.go │ ├── known_sync_error.go │ └── known_sync_error_test.go ├── get_main_pkgs.sh ├── RELEASING.md ├── go.sum ├── .golangci.yml └── versions.yaml /.codespellignore: -------------------------------------------------------------------------------- 1 | AKS 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | codespell==2.4.1 2 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/badreceiver/go.sum: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dbotconf/internal/testdata/invalid.yml: -------------------------------------------------------------------------------- 1 | invalid yaml 2 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/pkg/go.mod: -------------------------------------------------------------------------------- 1 | module foo/bar/pkg/pkg 2 | 3 | go 1.24.0 4 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/pkg/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: pkg 2 | status: 3 | class: pkg 4 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/altreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/badreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/bad2receiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/badreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/config_no_functions.yaml: -------------------------------------------------------------------------------- 1 | allowed_functions: 2 | - classes: 3 | - pkg 4 | -------------------------------------------------------------------------------- /checkapi/internal/testpkg/receiver/validreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/altreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: alt 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/badreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: bad 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/badreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: bad 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/badconfigreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configcallreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/unkeyedpkg/receiver/unkeyedreceiver/Makefile: -------------------------------------------------------------------------------- 1 | include ../../../../../../Makefile.Common 2 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/bad2receiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: bad2 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /checkapi/internal/testpkg/receiver/validreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: valid 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /issuegenerator/README.md: -------------------------------------------------------------------------------- 1 | # Issue Generator 2 | 3 | Tool that generates an issue if any test fails in the CI. 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.{cmd,[cC][mM][dD]} text eol=crlf 3 | *.{bat,[bB][aA][tT]} text eol=crlf 4 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/badconfigreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: config 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configcallreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: config 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /checkapi/internal/pkg/config_any_functions.yaml: -------------------------------------------------------------------------------- 1 | allowed_functions: 2 | - classes: 3 | - pkg 4 | name: "*" 5 | -------------------------------------------------------------------------------- /checkapi/internal/unkeyedpkg/receiver/unkeyedreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: unkeyed 2 | 3 | status: 4 | class: receiver -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testWork/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testExclude/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSimple/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSkip/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListAcyclic/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListCyclic/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListOrder/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testNoOverwrite/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testOverwrite/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testWork/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testWork/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSimplePrune/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListOrder/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListOrder/testC/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testC 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListAcyclic/testC/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testC 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListCyclic/testC/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testC 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /checkapi/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: checkapi 2 | 3 | status: 4 | stability: 5 | development: [] 6 | class: cmd 7 | codeowners: 8 | active: [atoulme] 9 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/altreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/altpkg/receiver/altreceiver 2 | 3 | go 1.24.0 4 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/badreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/altpkg/receiver/badreceiver 2 | 3 | go 1.24.0 4 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/badreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/badpkg/receiver/badreceiver 2 | 3 | go 1.24.0 4 | -------------------------------------------------------------------------------- /.markdownlint.yaml: -------------------------------------------------------------------------------- 1 | # Default state for all rules 2 | default: true 3 | 4 | # Configure long lines for tables and code blocks 5 | MD013: 6 | code_blocks: false 7 | tables: false 8 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/config_wrong_return_type.yaml: -------------------------------------------------------------------------------- 1 | allowed_functions: 2 | - name: SomeFunc 3 | classes: 4 | - pkg 5 | parameters: 6 | - string 7 | return_types: [string] 8 | -------------------------------------------------------------------------------- /dependencies.Dockerfile: -------------------------------------------------------------------------------- 1 | # This is a renovate-friendly source of Docker images. 2 | FROM python:3.13.6-slim-bullseye@sha256:e98b521460ee75bca92175c16247bdf7275637a8faaeb2bcfa19d879ae5c4b9a AS python 3 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testCyclic/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testCyclic/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot v1.0.0 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testCyclic/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSimple/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configreceiver/someothermodule/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/configreceiver/someothermodule 2 | 3 | go 1.24.0 4 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testNoOverwrite/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testOverwrite/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 -------------------------------------------------------------------------------- /multimod/internal/shared/sharedtest/test_data/README.md: -------------------------------------------------------------------------------- 1 | # `sharedtest` Test Data Directory 2 | 3 | This is an empty directory which will store temporary files created in the 4 | testing suite for the `sharedtest` package. 5 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/config_missing_function.yaml: -------------------------------------------------------------------------------- 1 | allowed_functions: 2 | - name: MissingFunc 3 | classes: 4 | - pkg 5 | return_types: [bool] 6 | - name: CompletelyUnrelated 7 | classes: 8 | - receiver 9 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListAcyclic/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 6 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListAcyclic/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testC v1.0.0 6 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListCyclic/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 6 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListOrder/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testC v1.0.0 6 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/altreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package altreceiver 5 | 6 | func MyFoo(_ string) bool { 7 | return false 8 | } 9 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/receiver/badreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package badreceiver 5 | 6 | func ThisFuncWillError() string { 7 | return "foo" 8 | } 9 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/badreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package badreceiver 5 | 6 | func ThisFuncWillError() string { 7 | return "foo" 8 | } 9 | -------------------------------------------------------------------------------- /checkapi/internal/config/config.yaml: -------------------------------------------------------------------------------- 1 | component_api: true 2 | json_schema: 3 | check_present: true 4 | check_valid: true 5 | type_mappings: 6 | "DataDefinedElsewhere": "http://example.com/schemas/external_schema.json#/properties/data" -------------------------------------------------------------------------------- /checkapi/internal/unkeyedpkg/receiver/unkeyedreceiver/ignored_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package unkeyedreceiver 5 | 6 | type MyFoo struct { 7 | Foo string 8 | } 9 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configreceiver/someothermodule/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package someothermodule 5 | 6 | type SomeOtherModule struct { 7 | Foo string 8 | } 9 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListCyclic/allow-circular.txt: -------------------------------------------------------------------------------- 1 | # This file lists the modules that are expected to have circular dependencies. 2 | # If it does not match the actual list, `crosslink tidylist` will return an error. 3 | testA 4 | testB 5 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/config_only_one_allowed.yaml: -------------------------------------------------------------------------------- 1 | allowed_functions: 2 | - name: SomeFunc 3 | classes: 4 | - pkg 5 | return_types: [bool] 6 | parameters: 7 | - string 8 | - name: CompletelyUnrelated 9 | classes: 10 | - receiver 11 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListCyclic/allow-circular-overpermissive.txt: -------------------------------------------------------------------------------- 1 | # This file lists the modules that are expected to have circular dependencies. 2 | # If it does not match the actual list, `crosslink tidylist` will return an error. 3 | testA 4 | testB 5 | testC 6 | -------------------------------------------------------------------------------- /githubgen/testdata/chloggen_components/.chloggen/config.yaml: -------------------------------------------------------------------------------- 1 | entries_dir: .chloggen 2 | 3 | template_yaml: .chloggen/TEMPLATE.yaml 4 | 5 | change_logs: 6 | user: CHANGELOG.md 7 | api: CHANGELOG-API.md 8 | 9 | default_change_logs: [user] 10 | 11 | components: [foo, bar] -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testNoOverwrite/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 6 | 7 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ../testA -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testOverwrite/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 6 | 7 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ../testA -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSkip/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 6 | 7 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testExclude/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 6 | 7 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testTidyListCyclic/testB/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testB 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 6 | require go.opentelemetry.io/build-tools/crosslink/testroot/testC v1.0.0 7 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSimplePrune/testA/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot/testA 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0 6 | 7 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB 8 | -------------------------------------------------------------------------------- /checkfile/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/checkfile 2 | 3 | go 1.24.0 4 | 5 | require github.com/stretchr/testify v1.11.1 6 | 7 | require ( 8 | github.com/davecgh/go-spew v1.1.1 // indirect 9 | github.com/pmezard/go-difflib v1.0.0 // indirect 10 | gopkg.in/yaml.v3 v3.0.1 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /checkapi/internal/testpkg/receiver/validreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package validreceiver 5 | 6 | import ( 7 | "go.opentelemetry.io/collector/receiver" 8 | ) 9 | 10 | func NewFactory() receiver.Factory { 11 | return nil 12 | } 13 | -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | # https://github.com/codespell-project/codespell 2 | [codespell] 3 | builtin = clear,rare,informal 4 | check-filenames = 5 | check-hidden = 6 | ignore-words = .codespellignore 7 | interactive = 1 8 | skip = .git,go.mod,go.sum,go.work,go.work.sum,semconv,venv,.tools 9 | uri-ignore-words-list = * 10 | write = 11 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configreceiver/emb/embedded.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package emb 5 | 6 | type Config struct { 7 | Foo string `mapstructure:"foo"` 8 | MySpecialEmbeddedField string `mapstructure:"my_special_embedded_field"` 9 | } 10 | -------------------------------------------------------------------------------- /checkapi/internal/unkeyedpkg/receiver/unkeyedreceiver/internal/internal.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package internal 5 | 6 | // An exported internal struct should not raise any unkeyed literal initialization checks. 7 | type InternalStruct struct { 8 | Foo string 9 | } 10 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/pkg/pkg.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package pkg 5 | 6 | type SomeStruct struct { 7 | OneField string 8 | } 9 | 10 | func SomeFunc(foo string) bool { 11 | return foo == "foo" 12 | } 13 | 14 | func OtherFunc(bar string) bool { 15 | return bar == "bar" 16 | } 17 | -------------------------------------------------------------------------------- /gotmpl/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/gotmpl 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/spf13/pflag v1.0.10 7 | github.com/stretchr/testify v1.11.1 8 | ) 9 | 10 | require ( 11 | github.com/davecgh/go-spew v1.1.1 // indirect 12 | github.com/pmezard/go-difflib v1.0.0 // indirect 13 | gopkg.in/yaml.v3 v3.0.1 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/bad2receiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package bad2receiver 5 | 6 | import "go.opentelemetry.io/collector/receiver" 7 | 8 | func NewFactory() receiver.Factory { 9 | return nil 10 | } 11 | 12 | func ThisFuncWillError[T ~string](foo T) T { 13 | return T("foo") 14 | } 15 | -------------------------------------------------------------------------------- /checkapi/internal/pkg/config_allowed.yaml: -------------------------------------------------------------------------------- 1 | allowed_functions: 2 | - name: SomeFunc 3 | classes: 4 | - pkg 5 | return_types: [bool] 6 | parameters: 7 | - string 8 | - name: OtherFunc 9 | classes: 10 | - pkg 11 | return_types: [ bool ] 12 | parameters: 13 | - string 14 | - name: CompletelyUnrelated 15 | classes: 16 | - receiver 17 | -------------------------------------------------------------------------------- /chloggen/internal/chlog/testdata/CHANGELOG_custom: -------------------------------------------------------------------------------- 1 | 2 | ## 1.0 3 | 4 | ### 🛑 Breaking changes 🛑 5 | 6 | - `foo`: broke foo ([#123](https://github.com/open-telemetry/opentelemetry-go-build-tools/issues/123)) 7 | - `bar`: broke bar ([#345](https://github.com/open-telemetry/opentelemetry-go-build-tools/issues/345), [#678](https://github.com/open-telemetry/opentelemetry-go-build-tools/issues/678)) 8 | more details 9 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testWork/go.work: -------------------------------------------------------------------------------- 1 | go 1.20 2 | 3 | // existing valid use statements under root should remain 4 | use ./testA 5 | 6 | // invalid use statements under root should be removed ONLY if prune is used 7 | use ./testC 8 | 9 | // use statements outside the root should remain 10 | use ../other-module 11 | 12 | // replace statements should remain 13 | replace foo.opentelemetery.io/bar => ../bar 14 | -------------------------------------------------------------------------------- /checkapi/internal/altpkg/config.yaml: -------------------------------------------------------------------------------- 1 | ignored_paths: 2 | - receiver/badreceiver 3 | allowed_functions: 4 | - name: MyFoo 5 | classes: 6 | - receiver 7 | parameters: [string] 8 | return_types: [bool] 9 | - name: MyBar 10 | classes: 11 | - receiver 12 | parameters: [ bool ] 13 | return_types: [ string ] 14 | 15 | ignored_functions: 16 | - ^Test.* 17 | - ^Benchmark.* 18 | - ^Fuzz.* 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | 4 | .cache/ 5 | .tools/ 6 | .idea/ 7 | .vscode/ 8 | *.iml 9 | *.so 10 | coverage.* 11 | /go.work 12 | go.work.sum 13 | 14 | crosslink/internal/test_data/ 15 | !crosslink/internal/test_data/.placeholder 16 | 17 | checkfile/checkfile 18 | chloggen/chloggen 19 | crosslink/crosslink 20 | dbotconf/dbotconf 21 | issuegenerator/issuegenerator 22 | gotmpl/gotmpl 23 | multimod/multimod 24 | *.exe 25 | -------------------------------------------------------------------------------- /checkfile/README.md: -------------------------------------------------------------------------------- 1 | # File checker 2 | 3 | Tool that checks the components enabled in OpenTelemetry core and contrib repos 4 | contain the file provided in argument --file-name. 5 | 6 | Usage: 7 | 8 | ```sh 9 | checkfile --project-path path/to/project \ 10 | --component-rel-path service/defaultcomponents/defaults.go \ 11 | --module-name go.opentelemetry.io/collector 12 | --file-name README.md 13 | ``` 14 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSimple/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 6 | 7 | // ensure they do not get pruned if prune flag is not set 8 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testZ => ./testZ 9 | 10 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testY => ./testY -------------------------------------------------------------------------------- /.github/workflows/check_links_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignorePatterns": [ 3 | { 4 | "pattern": "http(s)?://\\d+\\.\\d+\\.\\d+\\.\\d+" 5 | }, 6 | { 7 | "pattern": "http(s)?://localhost" 8 | }, 9 | { 10 | "pattern": "http(s)?://example.com" 11 | }, 12 | { 13 | "pattern": "^#" 14 | } 15 | ], 16 | "aliveStatusCodes": [429, 200] 17 | } 18 | -------------------------------------------------------------------------------- /chloggen/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/chloggen 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/spf13/cobra v1.10.2 7 | github.com/stretchr/testify v1.11.1 8 | gopkg.in/yaml.v3 v3.0.1 9 | ) 10 | 11 | require ( 12 | github.com/davecgh/go-spew v1.1.1 // indirect 13 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 14 | github.com/pmezard/go-difflib v1.0.0 // indirect 15 | github.com/spf13/pflag v1.0.10 // indirect 16 | ) 17 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/stretchr/testify v1.11.1 7 | golang.org/x/mod v0.31.0 8 | golang.org/x/sys v0.39.0 9 | ) 10 | 11 | require ( 12 | github.com/davecgh/go-spew v1.1.1 // indirect 13 | github.com/kr/text v0.2.0 // indirect 14 | github.com/pmezard/go-difflib v1.0.0 // indirect 15 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect 16 | gopkg.in/yaml.v3 v3.0.1 // indirect 17 | ) 18 | -------------------------------------------------------------------------------- /.github/workflows/fossa.yml: -------------------------------------------------------------------------------- 1 | name: FOSSA scanning 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | fossa: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 16 | 17 | - uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 18 | with: 19 | api-key: ${{secrets.FOSSA_API_KEY}} 20 | team: OpenTelemetry 21 | -------------------------------------------------------------------------------- /chloggen/README.md: -------------------------------------------------------------------------------- 1 | # Changelog generator 2 | 3 | Tool that can be used to generate a CHANGELOG file from individual change 4 | files written in YAML. 5 | 6 | Usage: 7 | 8 | ```sh 9 | # generates a new change YAML file from a template 10 | chloggen new -filename 11 | # validates all change YAML files 12 | chloggen validate 13 | # provide a preview of the generated changelog file 14 | chloggen update -dry 15 | # updates the changelog file 16 | chloggen update -version 17 | ``` 18 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.44.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 10 | 11 | ### 💡 Enhancements 💡 12 | 13 | - `filterprocessor`: Ability to filter `Spans` (#6341) 14 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 15 | 16 | ### 🧰 Bug fixes 🧰 17 | 18 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 19 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/dry_run/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.44.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 10 | 11 | ### 💡 Enhancements 💡 12 | 13 | - `filterprocessor`: Ability to filter `Spans` (#6341) 14 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 15 | 16 | ### 🧰 Bug fixes 🧰 17 | 18 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 19 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/filter_component_no_match/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ## v0.44.0 8 | 9 | ### 🛑 Breaking changes 🛑 10 | 11 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 12 | 13 | ### 💡 Enhancements 💡 14 | 15 | - `filterprocessor`: Ability to filter `Spans` (#6341) 16 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 17 | 18 | ### 🧰 Bug fixes 🧰 19 | 20 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 21 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSkip/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 6 | 7 | // should not be replaced or overwritten 8 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ./testA 9 | 10 | // included in exclude slice and should be ignored 11 | // replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB" 12 | 13 | // should not be pruned 14 | replace go.opentelemetry.io/build-tools/excludeme => ../excludeme 15 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testExclude/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 6 | 7 | // should not be replaced or overwritten 8 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ../testA 9 | 10 | // included in exclude slice and should be ignored 11 | // replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB" 12 | 13 | // should not be pruned 14 | replace go.opentelemetry.io/build-tools/excludeme => ../excludeme 15 | -------------------------------------------------------------------------------- /githubgen/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/githubgen 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/google/go-github/v80 v80.0.0 7 | github.com/stretchr/testify v1.11.1 8 | gopkg.in/yaml.v3 v3.0.1 9 | ) 10 | 11 | require ( 12 | github.com/davecgh/go-spew v1.1.1 // indirect 13 | github.com/google/go-querystring v1.1.0 // indirect 14 | github.com/kr/pretty v0.3.1 // indirect 15 | github.com/pmezard/go-difflib v1.0.0 // indirect 16 | github.com/rogpeppe/go-internal v1.14.1 // indirect 17 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect 18 | ) 19 | -------------------------------------------------------------------------------- /crosslink/internal/mock_test_data/testSimplePrune/gomod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink/testroot 2 | 3 | go 1.20 4 | 5 | require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0 6 | 7 | // ensure they do not get pruned if prune flag is not set 8 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testZ => ./testZ 9 | 10 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testY => ./testY 11 | 12 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ./testA 13 | 14 | replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB 15 | -------------------------------------------------------------------------------- /dbotconf/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/dbotconf 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/spf13/cobra v1.10.2 7 | github.com/stretchr/testify v1.11.1 8 | go.opentelemetry.io/build-tools v0.29.0 9 | golang.org/x/mod v0.31.0 10 | gopkg.in/yaml.v3 v3.0.1 11 | ) 12 | 13 | require ( 14 | github.com/davecgh/go-spew v1.1.1 // indirect 15 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 16 | github.com/kr/pretty v0.3.1 // indirect 17 | github.com/pmezard/go-difflib v1.0.0 // indirect 18 | github.com/spf13/pflag v1.0.10 // indirect 19 | ) 20 | 21 | replace go.opentelemetry.io/build-tools => ../ 22 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/bug_fix_only/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🧰 Bug fixes 🧰 8 | 9 | - `testbed`: Fix blah (#12346, #12347) 10 | 11 | ## v0.44.0 12 | 13 | ### 🛑 Breaking changes 🛑 14 | 15 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 16 | 17 | ### 💡 Enhancements 💡 18 | 19 | - `filterprocessor`: Ability to filter `Spans` (#6341) 20 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 21 | 22 | ### 🧰 Bug fixes 🧰 23 | 24 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 25 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/deprecation_only/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🚩 Deprecations 🚩 8 | 9 | - `exporter/old`: Deprecate old (#12348) 10 | 11 | ## v0.44.0 12 | 13 | ### 🛑 Breaking changes 🛑 14 | 15 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 16 | 17 | ### 💡 Enhancements 💡 18 | 19 | - `filterprocessor`: Ability to filter `Spans` (#6341) 20 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 21 | 22 | ### 🧰 Bug fixes 🧰 23 | 24 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 25 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/enhancement_only/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 💡 Enhancements 💡 8 | 9 | - `receiver/foo`: Add some bar (#12345) 10 | 11 | ## v0.44.0 12 | 13 | ### 🛑 Breaking changes 🛑 14 | 15 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 16 | 17 | ### 💡 Enhancements 💡 18 | 19 | - `filterprocessor`: Ability to filter `Spans` (#6341) 20 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 21 | 22 | ### 🧰 Bug fixes 🧰 23 | 24 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 25 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/new_component_only/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🚀 New components 🚀 8 | 9 | - `exporter/new`: Add new exporter ... (#12349) 10 | 11 | ## v0.44.0 12 | 13 | ### 🛑 Breaking changes 🛑 14 | 15 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 16 | 17 | ### 💡 Enhancements 💡 18 | 19 | - `filterprocessor`: Ability to filter `Spans` (#6341) 20 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 21 | 22 | ### 🧰 Bug fixes 🧰 23 | 24 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 25 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/breaking_only/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `processor/oops`: Change behavior when ... (#12350) 10 | 11 | ## v0.44.0 12 | 13 | ### 🛑 Breaking changes 🛑 14 | 15 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 16 | 17 | ### 💡 Enhancements 💡 18 | 19 | - `filterprocessor`: Ability to filter `Spans` (#6341) 20 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 21 | 22 | ### 🧰 Bug fixes 🧰 23 | 24 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 25 | -------------------------------------------------------------------------------- /chloggen/internal/chlog/testdata/CHANGELOG: -------------------------------------------------------------------------------- 1 | 2 | ## 1.0 3 | 4 | ### 🛑 Breaking changes 🛑 5 | 6 | - `foo`: broke foo (#123) 7 | - `bar`: broke bar (#345, #678) 8 | more details 9 | 10 | ### 🚩 Deprecations 🚩 11 | 12 | - `foo`: deprecate foo (#1234) 13 | - `bar`: deprecate bar (#3456, #6789) 14 | more details 15 | 16 | ### 🚀 New components 🚀 17 | 18 | - `foo`: new foo (#2) 19 | - `bar`: new bar (#4, #7) 20 | more details 21 | 22 | ### 💡 Enhancements 💡 23 | 24 | - `foo`: enhance foo (#12) 25 | - `bar`: enhance bar (#34, #67) 26 | more details 27 | 28 | ### 🧰 Bug fixes 🧰 29 | 30 | - `foo`: bug foo (#1) 31 | - `bar`: bug bar (#3, #6) 32 | more details 33 | -------------------------------------------------------------------------------- /crosslink/internal/test_data/.placeholder: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /issuegenerator/testdata/junit/package1-junit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | === RUN TestFailure --- FAIL: TestFailure (0.00s) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /issuegenerator/testdata/junit/package2-junit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | === RUN TestFailure --- FAIL: TestFailure (0.00s) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.chloggen/TEMPLATE.yaml: -------------------------------------------------------------------------------- 1 | # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' 2 | change_type: 3 | 4 | # The name of the component, or a single word describing the area of concern, (e.g. crosslink) 5 | component: 6 | 7 | # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). 8 | note: 9 | 10 | # One or more tracking issues related to the change 11 | issues: [] 12 | 13 | # (Optional) One or more lines of additional information to render under the primary note. 14 | # These lines will be padded with 2 spaces and then inserted directly into the document. 15 | # Use pipe (|) for multiline entries. 16 | subtext: 17 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/filter_component/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 💡 Enhancements 💡 8 | 9 | - `receiver/foo`: Some change (#1) 10 | - `receiver/foo`: One more foo change (#4) 11 | 12 | ## v0.44.0 13 | 14 | ### 🛑 Breaking changes 🛑 15 | 16 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 17 | 18 | ### 💡 Enhancements 💡 19 | 20 | - `filterprocessor`: Ability to filter `Spans` (#6341) 21 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 22 | 23 | ### 🧰 Bug fixes 🧰 24 | 25 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 26 | -------------------------------------------------------------------------------- /githubgen/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | package main 4 | 5 | const startComponentList = `# Start components list` 6 | const endComponentList = `# End components list` 7 | const startUnmaintainedList = `# Start unmaintained components list` 8 | const endUnmaintainedList = `# End unmaintained components list` 9 | const startDeprecatedList = `# Start deprecated components list` 10 | const endDeprecatedList = `# End deprecated components list` 11 | const startDistributionList = `# Start distribution list` 12 | const endDistributionList = `# End distribution list` 13 | const unmaintainedStatus = "unmaintained" 14 | const deprecatedStatus = "deprecated" 15 | -------------------------------------------------------------------------------- /gotmpl/testdata/want.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package myname 16 | 17 | func foo() { 18 | } 19 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/.chloggen/TEMPLATE.yaml: -------------------------------------------------------------------------------- 1 | # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' 2 | change_type: 3 | 4 | # The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) 5 | component: 6 | 7 | # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). 8 | note: 9 | 10 | # One or more tracking issues related to the change 11 | issues: [] 12 | 13 | # (Optional) One or more lines of additional information to render under the primary note. 14 | # These lines will be padded with 2 spaces and then inserted directly into the document. 15 | # Use pipe (|) for multiline entries. 16 | subtext: 17 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/subtext/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `processor/oops`: Change behavior when ... (#12350) 10 | - foo 11 | - bar 12 | - blah 13 | - 1234567 14 | 15 | ## v0.44.0 16 | 17 | ### 🛑 Breaking changes 🛑 18 | 19 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 20 | 21 | ### 💡 Enhancements 💡 22 | 23 | - `filterprocessor`: Ability to filter `Spans` (#6341) 24 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 25 | 26 | ### 🧰 Bug fixes 🧰 27 | 28 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 29 | -------------------------------------------------------------------------------- /gotmpl/testdata/in.go.tmpl: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package {{.pkg}} 16 | 17 | func foo() { 18 | } 19 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # 3 | # List of approvers for OpenTelemetry Build repository 4 | # 5 | ##################################################### 6 | # 7 | # Learn about membership in OpenTelemetry community: 8 | # https://github.com/open-telemetry/community/blob/master/community-membership.md 9 | # 10 | # 11 | # Learn about CODEOWNERS file format: 12 | # https://help.github.com/en/articles/about-code-owners 13 | # 14 | # For anything not explicitly taken by someone else: 15 | 16 | * @open-telemetry/go-maintainers @open-telemetry/go-approvers @open-telemetry/collector-maintainers @open-telemetry/collector-approvers @open-telemetry/collector-contrib-maintainers @open-telemetry/collector-contrib-approvers 17 | -------------------------------------------------------------------------------- /.chloggen/fix-tidylist-validate.yaml: -------------------------------------------------------------------------------- 1 | # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' 2 | change_type: bug_fix 3 | 4 | # The name of the component, or a single word describing the area of concern, (e.g. crosslink) 5 | component: crosslink 6 | 7 | # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). 8 | note: Fix false negatives in `crosslink tidylist --validate` 9 | 10 | # One or more tracking issues related to the change 11 | issues: [1437] 12 | 13 | # (Optional) One or more lines of additional information to render under the primary note. 14 | # These lines will be padded with 2 spaces and then inserted directly into the document. 15 | # Use pipe (|) for multiline entries. 16 | subtext: 17 | -------------------------------------------------------------------------------- /multimod/internal/verify/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package verify provides helper functions for verifying a versioning config file. 16 | package verify 17 | -------------------------------------------------------------------------------- /multimod/internal/shared/sharedtest/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package sharedtest provides exported shared helper functions for testing. 16 | package sharedtest 17 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/all_change_types_alphabetical/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 💡 Enhancements 💡 8 | 9 | - `receiver/a`: Some change (#1) 10 | - `receiver/aa`: Some other change for aa (#2) 11 | - `receiver/b`: Some other change (#3) 12 | - `receiver/bb`: One more bb change (#4) 13 | 14 | ## v0.44.0 15 | 16 | ### 🛑 Breaking changes 🛑 17 | 18 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 19 | 20 | ### 💡 Enhancements 💡 21 | 22 | - `filterprocessor`: Ability to filter `Spans` (#6341) 23 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 24 | 25 | ### 🧰 Bug fixes 🧰 26 | 27 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 28 | -------------------------------------------------------------------------------- /multimod/internal/tag/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package tag provides helper functions for tagging a commit with the new 16 | // module versions. 17 | package tag 18 | -------------------------------------------------------------------------------- /multimod/internal/sync/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package sync provides helper functions for synchronizing a current repo 16 | // with the versioning file of another repo. 17 | package sync 18 | -------------------------------------------------------------------------------- /chloggen/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Chloggen generates changelog entries. 16 | package main 17 | 18 | import ( 19 | "go.opentelemetry.io/build-tools/chloggen/cmd" 20 | ) 21 | 22 | func main() { 23 | cmd.Execute() 24 | } 25 | -------------------------------------------------------------------------------- /checkapi/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/checkapi 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/goccy/go-json v0.10.5 7 | github.com/kaptinlin/jsonschema v0.4.12 8 | github.com/stretchr/testify v1.11.1 9 | gopkg.in/yaml.v3 v3.0.1 10 | ) 11 | 12 | require ( 13 | github.com/davecgh/go-spew v1.1.1 // indirect 14 | github.com/go-json-experiment/json v0.0.0-20250813233538-9b1f9ea2e11b // indirect 15 | github.com/goccy/go-yaml v1.19.1 // indirect 16 | github.com/kaptinlin/go-i18n v0.1.6 // indirect 17 | github.com/kaptinlin/messageformat-go v0.4.0 // indirect 18 | github.com/kr/pretty v0.3.1 // indirect 19 | github.com/pmezard/go-difflib v1.0.0 // indirect 20 | github.com/rogpeppe/go-internal v1.14.1 // indirect 21 | golang.org/x/text v0.32.0 // indirect 22 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect 23 | ) 24 | -------------------------------------------------------------------------------- /multimod/internal/prerelease/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package prerelease provides helper functions for running prerelease steps, 16 | // such as updating module version numbers and creating automatic commits. 17 | package prerelease 18 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/badconfigreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package configreceiver 5 | 6 | import "go.opentelemetry.io/collector/component" 7 | 8 | func createDefaultConfig() component.Config { 9 | return &Config{ 10 | Foo: []string{"foo"}, 11 | Sub: SubConfig{ 12 | Foo: "foo", 13 | Bar: false, 14 | Sub2: SubConfig2{ 15 | FooBar: "foobar", 16 | }, 17 | }, 18 | } 19 | } 20 | 21 | type Config struct { 22 | Foo []string 23 | Bar map[string]string 24 | Bool bool 25 | StrChan chan string 26 | Sub SubConfig 27 | } 28 | 29 | type SubConfig struct { 30 | Foo string 31 | Bar bool 32 | Sub2 SubConfig2 33 | } 34 | 35 | type SubConfig2 struct { 36 | FooBar string 37 | } 38 | 39 | type ExtraStruct struct { 40 | SomeField string 41 | } 42 | -------------------------------------------------------------------------------- /multimod/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Multimod enables the release of Go modules with flexible versioning. 16 | package main 17 | 18 | import "go.opentelemetry.io/build-tools/multimod/cmd" 19 | 20 | func main() { 21 | cmd.Execute() 22 | } 23 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configreceiver/metadata.yaml: -------------------------------------------------------------------------------- 1 | type: config 2 | 3 | status: 4 | class: receiver 5 | 6 | config: 7 | properties: 8 | bar: 9 | type: string 10 | bool: 11 | type: boolean 12 | data_defined_elsewhere: 13 | $ref: http://example.com/schemas/external_schema.json#/properties/data 14 | foo: 15 | type: string 16 | my_special_embedded_field: 17 | type: string 18 | ptrStruct: 19 | type: object 20 | subconfig: 21 | allOf: 22 | - $ref: http://example.com/schemas/external_schema.json#/properties/data 23 | properties: 24 | bar: 25 | type: boolean 26 | foo: 27 | type: string 28 | sub_config2: 29 | properties: 30 | foobar: 31 | type: string 32 | type: object 33 | type: object 34 | type: object -------------------------------------------------------------------------------- /crosslink/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/crosslink 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/google/go-cmp v0.7.0 7 | github.com/otiai10/copy v1.14.1 8 | github.com/spf13/cobra v1.10.2 9 | github.com/spf13/pflag v1.0.10 10 | github.com/stretchr/testify v1.11.1 11 | go.opentelemetry.io/build-tools v0.29.0 12 | go.uber.org/zap v1.27.1 13 | golang.org/x/mod v0.31.0 14 | ) 15 | 16 | require ( 17 | github.com/davecgh/go-spew v1.1.1 // indirect 18 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 19 | github.com/kr/pretty v0.3.1 // indirect 20 | github.com/otiai10/mint v1.6.3 // indirect 21 | github.com/pmezard/go-difflib v1.0.0 // indirect 22 | go.uber.org/multierr v1.11.0 // indirect 23 | golang.org/x/sync v0.19.0 // indirect 24 | golang.org/x/sys v0.39.0 // indirect 25 | gopkg.in/yaml.v3 v3.0.1 // indirect 26 | ) 27 | 28 | replace go.opentelemetry.io/build-tools => ../ 29 | -------------------------------------------------------------------------------- /crosslink/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Crosslink updates mono-repo go.mod. It ensures local versions of modules 16 | // are used when building the code. 17 | package main 18 | 19 | import "go.opentelemetry.io/build-tools/crosslink/cmd" 20 | 21 | func main() { 22 | cmd.Execute() 23 | } 24 | -------------------------------------------------------------------------------- /checkfile/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 2 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 4 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 5 | github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 6 | github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 7 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 8 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 9 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 10 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 11 | -------------------------------------------------------------------------------- /.github/workflows/gosec.yml: -------------------------------------------------------------------------------- 1 | name: Run Gosec 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | # ┌───────────── minute (0 - 59) 6 | # │ ┌───────────── hour (0 - 23) 7 | # │ │ ┌───────────── day of the month (1 - 31) 8 | # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) 9 | # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) 10 | # │ │ │ │ │ 11 | # │ │ │ │ │ 12 | # │ │ │ │ │ 13 | # * * * * * 14 | - cron: '30 2 * * *' 15 | permissions: 16 | contents: read 17 | jobs: 18 | tests: 19 | runs-on: ubuntu-latest 20 | env: 21 | GO111MODULE: on 22 | steps: 23 | - name: Checkout Source 24 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 25 | - name: Run Gosec Security Scanner 26 | uses: securego/gosec@master 27 | with: 28 | args: ./... 29 | 30 | -------------------------------------------------------------------------------- /issuegenerator/testdata/junit/package3-junit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | === RUN TestFailure --- FAIL: TestFailure (0.00s) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /multimod/internal/tag/test_data/new_tagger/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /dbotconf/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Dbotconf configures and validates dependabot configuration. 16 | package main 17 | 18 | import ( 19 | "os" 20 | 21 | "go.opentelemetry.io/build-tools/dbotconf/internal" 22 | ) 23 | 24 | func main() { 25 | if err := internal.BuildAndExecute(); err != nil { 26 | os.Exit(1) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /multimod/internal/prerelease/test_data/new_prerelease/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/get_dependencies/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/new_verification/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /multimod/internal/shared/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package shared provides helper functions for reading and parsing Module versioning 16 | // files, as well as common functions used by multiple commands in the Cobra application. 17 | package shared // nolint:revive // keeping generic package name until a proper refactoring is done 18 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/new_module_set_release/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/new_module_versioning/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/read_versioning_filename/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/configreceiver 2 | 3 | go 1.24.0 4 | 5 | require go.opentelemetry.io/collector/component v1.48.0 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 9 | github.com/hashicorp/go-version v1.8.0 // indirect 10 | github.com/json-iterator/go v1.1.12 // indirect 11 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 12 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect 13 | go.opentelemetry.io/collector/featuregate v1.48.0 // indirect 14 | go.opentelemetry.io/collector/pdata v1.48.0 // indirect 15 | go.opentelemetry.io/otel v1.39.0 // indirect 16 | go.opentelemetry.io/otel/metric v1.39.0 // indirect 17 | go.opentelemetry.io/otel/trace v1.39.0 // indirect 18 | go.uber.org/multierr v1.11.0 // indirect 19 | go.uber.org/zap v1.27.1 // indirect 20 | ) 21 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/verify_git_tags_do_not_already_exist/versions_invalid_syntax.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | - should-not-have-front-dash: 17 | version: v1.0.0 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | excluded-modules: 22 | - go.opentelemetry.io/excluded1 23 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configcallreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/configreceiver 2 | 3 | go 1.24.0 4 | 5 | require go.opentelemetry.io/collector/component v1.48.0 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 9 | github.com/hashicorp/go-version v1.8.0 // indirect 10 | github.com/json-iterator/go v1.1.12 // indirect 11 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 12 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect 13 | go.opentelemetry.io/collector/featuregate v1.48.0 // indirect 14 | go.opentelemetry.io/collector/pdata v1.48.0 // indirect 15 | go.opentelemetry.io/otel v1.39.0 // indirect 16 | go.opentelemetry.io/otel/metric v1.39.0 // indirect 17 | go.opentelemetry.io/otel/trace v1.39.0 // indirect 18 | go.uber.org/multierr v1.11.0 // indirect 19 | go.uber.org/zap v1.27.1 // indirect 20 | ) 21 | -------------------------------------------------------------------------------- /issuegenerator/go.mod: -------------------------------------------------------------------------------- 1 | module go.opentelemetry.io/build-tools/issuegenerator 2 | 3 | go 1.24.4 4 | 5 | toolchain go1.24.7 6 | 7 | require ( 8 | github.com/google/go-github/v80 v80.0.0 9 | github.com/joshdk/go-junit v1.0.0 10 | github.com/migueleliasweb/go-github-mock v1.5.0 11 | github.com/stretchr/testify v1.11.1 12 | go.uber.org/zap v1.27.1 13 | golang.org/x/oauth2 v0.34.0 14 | ) 15 | 16 | require ( 17 | github.com/davecgh/go-spew v1.1.1 // indirect 18 | github.com/google/go-github/v73 v73.0.0 // indirect 19 | github.com/google/go-querystring v1.1.0 // indirect 20 | github.com/gorilla/mux v1.8.1 // indirect 21 | github.com/kr/pretty v0.3.1 // indirect 22 | github.com/pmezard/go-difflib v1.0.0 // indirect 23 | github.com/rogpeppe/go-internal v1.14.1 // indirect 24 | go.uber.org/multierr v1.11.0 // indirect 25 | golang.org/x/time v0.14.0 // indirect 26 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect 27 | gopkg.in/yaml.v3 v3.0.1 // indirect 28 | ) 29 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/badconfigreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/badconfigreceiver 2 | 3 | go 1.24.0 4 | 5 | require go.opentelemetry.io/collector/component v1.48.0 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 9 | github.com/hashicorp/go-version v1.8.0 // indirect 10 | github.com/json-iterator/go v1.1.12 // indirect 11 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 12 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect 13 | go.opentelemetry.io/collector/featuregate v1.48.0 // indirect 14 | go.opentelemetry.io/collector/pdata v1.48.0 // indirect 15 | go.opentelemetry.io/otel v1.39.0 // indirect 16 | go.opentelemetry.io/otel/metric v1.39.0 // indirect 17 | go.opentelemetry.io/otel/trace v1.39.0 // indirect 18 | go.uber.org/multierr v1.11.0 // indirect 19 | go.uber.org/zap v1.27.1 // indirect 20 | ) 21 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/verify_all_modules_in_set/module_not_listed.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | excluded-modules: 25 | - go.opentelemetry.io/test/testexcluded 26 | -------------------------------------------------------------------------------- /githubgen/chloggencomponents.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package main 5 | 6 | import ( 7 | "fmt" 8 | "sort" 9 | 10 | "go.opentelemetry.io/build-tools/githubgen/datatype" 11 | ) 12 | 13 | type chloggenComponentsGenerator struct { 14 | writeComponents func(rootFolder string, cfg datatype.ChloggenConfig) error 15 | } 16 | 17 | func (cg *chloggenComponentsGenerator) Generate(data datatype.GithubData) error { 18 | components := make([]string, 1, len(data.Components)+1) 19 | components[0] = "all" 20 | for _, folder := range data.Folders { 21 | comp := data.Components[folder] 22 | if comp.Status != nil && comp.Status.Class != "" && comp.Type != "" { 23 | components = append(components, fmt.Sprintf("%s/%s", comp.Status.Class, comp.Type)) 24 | } else { 25 | components = append(components, folder) 26 | } 27 | } 28 | sort.Strings(components) 29 | cfg := data.Chloggen 30 | cfg.Components = components 31 | return cg.writeComponents(data.RootFolder, cfg) 32 | } 33 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/read_versioning_filename/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/test3 25 | excluded-modules: 26 | - go.opentelemetry.io/excluded1 27 | -------------------------------------------------------------------------------- /chloggen/internal/chlog/TEMPLATE.yaml: -------------------------------------------------------------------------------- 1 | # Use this changelog template to create an entry for release notes. 2 | 3 | # Optional: The change log or logs in which this entry should be included. 4 | # e.g. '[user]' or '[user, api]' 5 | # Include 'user' if the change is relevant to end users. 6 | # Include 'api' if there is a change to a library API. 7 | # Default: '[user]' 8 | change_logs: [] 9 | 10 | # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' 11 | change_type: 12 | 13 | # The name of the component, or a single word describing the area of concern, (e.g. crosslink) 14 | component: 15 | 16 | # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). 17 | note: 18 | 19 | # One or more tracking issues related to the change 20 | issues: [] 21 | 22 | # (Optional) One or more lines of additional information to render under the primary note. 23 | # These lines will be padded with 2 spaces and then inserted directly into the document. 24 | # Use pipe (|) for multiline entries. 25 | subtext: 26 | -------------------------------------------------------------------------------- /gotmpl/README.md: -------------------------------------------------------------------------------- 1 | # gotmpl 2 | 3 | `gotmpl` is a tool 4 | to generate files 5 | from [templates](https://pkg.go.dev/text/template) and JSON data. 6 | 7 | ## Usage 8 | 9 | ```sh 10 | Usage of gotmpl: 11 | -b, --body string Template body filepath. 12 | -d, --data string Data in JSON format. 13 | -o, --out string Output filepath. 14 | ``` 15 | 16 | ## Background 17 | 18 | `gotmpl` has been created as one of the solutions 19 | to avoid depending on internal packages of different modules. 20 | Such dependencies could transitively lead to build failure 21 | when an internal package API introduces a non-backward compatible change. 22 | 23 | `gotmpl` can be used for sharing non-exported 24 | common code across multiple Go modules. 25 | It is advised to keep the shared code in a separate internal Go module 26 | (e.g. under `internal/shared`). 27 | The shared code should be consumed across modules using `go generate`, 28 | for example: 29 | 30 | ```go 31 | //go:generate gotmpl --body=../internal/shared/env.go.tmpl "--data={ \"pkg\": \"jaeger\" }" --out=env.go 32 | ``` 33 | -------------------------------------------------------------------------------- /gotmpl/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 2 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 4 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 5 | github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= 6 | github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 7 | github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 8 | github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 9 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 10 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 11 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 12 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 13 | -------------------------------------------------------------------------------- /checkapi/README.md: -------------------------------------------------------------------------------- 1 | # CheckAPI 2 | 3 | CheckAPI is a go tool that parses the AST tree of a Go module, 4 | identifying Golang APIs such as structs and functions 5 | and enforcing rules against them. 6 | 7 | This is particularly useful to reduce the API surface of a Go module 8 | to a specific set of functions. 9 | 10 | ## Running CheckAPI 11 | 12 | ```shell 13 | $> checkapi -folder . -config config.yaml 14 | ``` 15 | 16 | ## Configuration 17 | 18 | The configuration file is in yaml format: 19 | 20 | ```yaml 21 | ignored_paths: 22 | - 23 | allowed_functions: 24 | - 25 | - name: 26 | parameters: 27 | return_types: 28 | 29 | ignored_functions: 30 | - 31 | unkeyed_literal_initialization: 32 | enabled: 33 | limit: 34 | ``` 35 | -------------------------------------------------------------------------------- /multimod/internal/tag/test_data/new_tagger/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/prerelease/test_data/new_prerelease/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/tag/test_data/delete_module_set_tags/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/new_verification/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/verify_versions/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /checkapi/internal/unkeyedpkg/receiver/unkeyedreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package unkeyedreceiver 5 | 6 | import ( 7 | "context" 8 | 9 | "go.opentelemetry.io/collector/receiver" 10 | ) 11 | 12 | func NewFactory() receiver.Factory { 13 | return nil 14 | } 15 | 16 | type MyInterface interface { 17 | Foo() string 18 | } 19 | 20 | type UnkeyedConfig struct { 21 | Foo []string 22 | Bar map[string]string 23 | Bool bool 24 | StrChan chan string 25 | } 26 | 27 | type ShutdownFunc func(context.Context) error 28 | 29 | type Metadata struct { 30 | data map[string][]string 31 | } 32 | 33 | type FooWithAnonymousField struct { 34 | Data string 35 | _ struct{} 36 | } 37 | 38 | type EmptyStruct struct{} 39 | 40 | type StructWithTooManyFields struct { 41 | Foo []string 42 | Bar map[string]string 43 | Foo2 string 44 | Bar2 string 45 | Foo3 string 46 | Bar3 string 47 | Foo4 string 48 | Bar4 string 49 | Foo5 string 50 | Bar5 string 51 | } 52 | 53 | type privateStruct struct { 54 | Foo string 55 | } 56 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/new_module_set_release/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test3 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/new_module_versioning/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test3 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/verify_versions/invalid_version.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: invalid-version-v.02.0. 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/verify_all_modules_in_set/module_not_in_repo.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/verify_all_modules_in_set/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | -------------------------------------------------------------------------------- /checkapi/internal/metadata.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package internal 5 | 6 | import ( 7 | "errors" 8 | "os" 9 | "path/filepath" 10 | 11 | "gopkg.in/yaml.v3" 12 | ) 13 | 14 | // Status of the component 15 | type Status struct { 16 | Class string `yaml:"class"` 17 | } 18 | 19 | // Metadata of the component 20 | type Metadata struct { 21 | Status Status `yaml:"status"` 22 | Config any `yaml:"config"` 23 | } 24 | 25 | // ReadMetadata reads from the metadata.yaml file in the given folder. 26 | func ReadMetadata(folder string) (Metadata, bool, error) { 27 | if _, err := os.Stat(filepath.Join(folder, "metadata.yaml")); errors.Is(err, os.ErrNotExist) { 28 | return Metadata{Status: Status{Class: "pkg"}}, false, nil 29 | } 30 | m, err := os.ReadFile(filepath.Join(folder, "metadata.yaml")) // #nosec G304 31 | if err != nil { 32 | return Metadata{}, false, err 33 | } 34 | var componentInfo Metadata 35 | if err = yaml.Unmarshal(m, &componentInfo); err != nil { 36 | return Metadata{}, false, err 37 | } 38 | return componentInfo, true, nil 39 | } 40 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/all_change_types/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `processor/oops`: Change behavior when ... (#12350) 10 | - `processor/oops`: Change behavior when ... (#12350) 11 | - foo 12 | - bar 13 | - blah 14 | - 1234567 15 | 16 | ### 🚩 Deprecations 🚩 17 | 18 | - `exporter/old`: Deprecate old (#12348) 19 | 20 | ### 🚀 New components 🚀 21 | 22 | - `exporter/new`: Add new exporter ... (#12349) 23 | 24 | ### 💡 Enhancements 💡 25 | 26 | - `receiver/foo`: Add some bar (#12345) 27 | 28 | ### 🧰 Bug fixes 🧰 29 | 30 | - `testbed`: Fix blah (#12346, #12347) 31 | 32 | ## v0.44.0 33 | 34 | ### 🛑 Breaking changes 🛑 35 | 36 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 37 | 38 | ### 💡 Enhancements 💡 39 | 40 | - `filterprocessor`: Ability to filter `Spans` (#6341) 41 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 42 | 43 | ### 🧰 Bug fixes 🧰 44 | 45 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 46 | -------------------------------------------------------------------------------- /multimod/internal/sync/test_data/new_sync/other_versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | other-mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/other/test/test1 20 | other-mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/other/test2 24 | other-mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/other/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/other/test/testexcluded 30 | -------------------------------------------------------------------------------- /multimod/internal/tag/test_data/tag_all_modules/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | - go.opentelemetry.io/test3 25 | mod-set-3: 26 | version: v2.2.2 27 | modules: 28 | - go.opentelemetry.io/testroot/v2 29 | excluded-modules: 30 | - go.opentelemetry.io/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/sync/test_data/update_all_go_mod_files/other_versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | other-mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/other/test/test1 20 | other-mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/other/test2 24 | other-mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/other/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/other/test/testexcluded 30 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/multiple_changelogs/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `receiver/foo`: Some change relevant to [user,api] (#11) 10 | 11 | ### 🚩 Deprecations 🚩 12 | 13 | - `receiver/foo`: Some change relevant to [user] (#123) 14 | - `receiver/foo`: Some change relevant to [user,api] (#234) 15 | 16 | ### 💡 Enhancements 💡 17 | 18 | - `receiver/foo`: Some change relevant to [user] (#21) 19 | - `receiver/foo`: Some change relevant to [api,user] (#333) 20 | 21 | ### 🧰 Bug fixes 🧰 22 | 23 | - `receiver/foo`: Some change relevant to [user] (#32) 24 | - `receiver/foo`: Some change relevant to [user] (#222) 25 | 26 | ## v0.44.0 27 | 28 | ### 🛑 Breaking changes 🛑 29 | 30 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 31 | 32 | ### 💡 Enhancements 💡 33 | 34 | - `filterprocessor`: Ability to filter `Spans` (#6341) 35 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 36 | 37 | ### 🧰 Bug fixes 🧰 38 | 39 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 40 | -------------------------------------------------------------------------------- /checkapi/internal/badpkg/receiver/bad2receiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/badpkg/receiver/bad2receiver 2 | 3 | go 1.24.0 4 | 5 | require go.opentelemetry.io/collector/receiver v1.48.0 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 9 | github.com/hashicorp/go-version v1.8.0 // indirect 10 | github.com/json-iterator/go v1.1.12 // indirect 11 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 12 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect 13 | go.opentelemetry.io/collector/component v1.48.0 // indirect 14 | go.opentelemetry.io/collector/consumer v1.48.0 // indirect 15 | go.opentelemetry.io/collector/featuregate v1.48.0 // indirect 16 | go.opentelemetry.io/collector/pdata v1.48.0 // indirect 17 | go.opentelemetry.io/collector/pipeline v1.48.0 // indirect 18 | go.opentelemetry.io/otel v1.39.0 // indirect 19 | go.opentelemetry.io/otel/metric v1.39.0 // indirect 20 | go.opentelemetry.io/otel/trace v1.39.0 // indirect 21 | go.uber.org/multierr v1.11.0 // indirect 22 | go.uber.org/zap v1.27.1 // indirect 23 | ) 24 | -------------------------------------------------------------------------------- /checkapi/internal/testpkg/receiver/validreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/testpkg/receiver/validreceiver 2 | 3 | go 1.24.0 4 | 5 | require go.opentelemetry.io/collector/receiver v1.48.0 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 9 | github.com/hashicorp/go-version v1.8.0 // indirect 10 | github.com/json-iterator/go v1.1.12 // indirect 11 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 12 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect 13 | go.opentelemetry.io/collector/component v1.48.0 // indirect 14 | go.opentelemetry.io/collector/consumer v1.48.0 // indirect 15 | go.opentelemetry.io/collector/featuregate v1.48.0 // indirect 16 | go.opentelemetry.io/collector/pdata v1.48.0 // indirect 17 | go.opentelemetry.io/collector/pipeline v1.48.0 // indirect 18 | go.opentelemetry.io/otel v1.39.0 // indirect 19 | go.opentelemetry.io/otel/metric v1.39.0 // indirect 20 | go.opentelemetry.io/otel/trace v1.39.0 // indirect 21 | go.uber.org/multierr v1.11.0 // indirect 22 | go.uber.org/zap v1.27.1 // indirect 23 | ) 24 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/verify_git_tags_do_not_already_exist/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test4 21 | mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/test3 25 | mod-set-3: 26 | version: v2.2.2 27 | modules: 28 | - go.opentelemetry.io/testroot/v2 29 | excluded-modules: 30 | - go.opentelemetry.io/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/sync/test_data/update_all_go_mod_files_with_commit_hash/other_versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | other-mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/other/test/test1 20 | other-mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/other/test2 24 | other-mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/other/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/other/test/testexcluded 30 | -------------------------------------------------------------------------------- /checkapi/internal/unkeyedpkg/receiver/unkeyedreceiver/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/testpkg/receiver/unkeyedreceiver 2 | 3 | go 1.24.0 4 | 5 | require go.opentelemetry.io/collector/receiver v1.48.0 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 9 | github.com/hashicorp/go-version v1.8.0 // indirect 10 | github.com/json-iterator/go v1.1.12 // indirect 11 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 12 | github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect 13 | go.opentelemetry.io/collector/component v1.48.0 // indirect 14 | go.opentelemetry.io/collector/consumer v1.48.0 // indirect 15 | go.opentelemetry.io/collector/featuregate v1.48.0 // indirect 16 | go.opentelemetry.io/collector/pdata v1.48.0 // indirect 17 | go.opentelemetry.io/collector/pipeline v1.48.0 // indirect 18 | go.opentelemetry.io/otel v1.39.0 // indirect 19 | go.opentelemetry.io/otel/metric v1.39.0 // indirect 20 | go.opentelemetry.io/otel/trace v1.39.0 // indirect 21 | go.uber.org/multierr v1.11.0 // indirect 22 | go.uber.org/zap v1.27.1 // indirect 23 | ) 24 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/multiple_changelogs_single_default/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `receiver/foo`: Some change relevant to [user,api] (#11) 10 | 11 | ### 🚩 Deprecations 🚩 12 | 13 | - `receiver/foo`: Some change relevant to [default] (#123) 14 | - `receiver/foo`: Some change relevant to [user,api] (#234) 15 | 16 | ### 💡 Enhancements 💡 17 | 18 | - `receiver/foo`: Some change relevant to [default] (#21) 19 | - `receiver/foo`: Some change relevant to [api,user] (#333) 20 | 21 | ### 🧰 Bug fixes 🧰 22 | 23 | - `receiver/foo`: Some change relevant to [default] (#32) 24 | - `receiver/foo`: Some change relevant to [default] (#222) 25 | 26 | ## v0.44.0 27 | 28 | ### 🛑 Breaking changes 🛑 29 | 30 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 31 | 32 | ### 💡 Enhancements 💡 33 | 34 | - `filterprocessor`: Ability to filter `Spans` (#6341) 35 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 36 | 37 | ### 🧰 Bug fixes 🧰 38 | 39 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 40 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/multiple_changelogs_multiple_defaults/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `receiver/foo`: Some change relevant to [user,api] (#11) 10 | 11 | ### 🚩 Deprecations 🚩 12 | 13 | - `receiver/foo`: Some change relevant to [default] (#123) 14 | - `receiver/foo`: Some change relevant to [user,api] (#234) 15 | 16 | ### 💡 Enhancements 💡 17 | 18 | - `receiver/foo`: Some change relevant to [default] (#21) 19 | - `receiver/foo`: Some change relevant to [api,user] (#333) 20 | 21 | ### 🧰 Bug fixes 🧰 22 | 23 | - `receiver/foo`: Some change relevant to [default] (#32) 24 | - `receiver/foo`: Some change relevant to [default] (#222) 25 | 26 | ## v0.44.0 27 | 28 | ### 🛑 Breaking changes 🛑 29 | 30 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 31 | 32 | ### 💡 Enhancements 💡 33 | 34 | - `filterprocessor`: Ability to filter `Spans` (#6341) 35 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 36 | 37 | ### 🧰 Bug fixes 🧰 38 | 39 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 40 | -------------------------------------------------------------------------------- /multimod/internal/prerelease/test_data/update_all/versions.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/all/test/test1 20 | - go.opentelemetry.io/all/test3 21 | mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/all/test/test2 25 | - go.opentelemetry.io/all 26 | mod-set-3: 27 | version: v2.2.2 28 | modules: 29 | - go.opentelemetry.io/all/v2 30 | excluded-modules: 31 | - go.opentelemetry.io/all/test/testexcluded 32 | -------------------------------------------------------------------------------- /internal/tools/tools.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //go:build tools 16 | // +build tools 17 | 18 | package tools 19 | 20 | import ( 21 | _ "github.com/client9/misspell/cmd/misspell" 22 | _ "github.com/gogo/protobuf/protoc-gen-gogofast" 23 | _ "github.com/golangci/golangci-lint/v2/cmd/golangci-lint" 24 | _ "github.com/matryer/moq" 25 | _ "go.opentelemetry.io/build-tools/chloggen" 26 | _ "go.opentelemetry.io/build-tools/crosslink" 27 | _ "go.opentelemetry.io/build-tools/dbotconf" 28 | _ "go.opentelemetry.io/build-tools/multimod" 29 | _ "golang.org/x/vuln/cmd/govulncheck" 30 | ) 31 | -------------------------------------------------------------------------------- /checkapi/config.yaml: -------------------------------------------------------------------------------- 1 | ignored_paths: 2 | - extension/observer 3 | - extension/encoding 4 | - extension/opampcustommessages 5 | - processor/tailsamplingprocessor 6 | - receiver/pulsarreceiver # 38930 7 | - exporter/pulsarexporter # 38929 8 | - exporter/elasticsearchexporter/integrationtest 9 | excluded_files: 10 | - ignored_*.go 11 | unkeyed_literal_initialization: 12 | enabled: true 13 | limit: 6 14 | allowed_functions: 15 | - classes: 16 | - connector 17 | name: NewFactory 18 | parameters: 19 | return_types: [connector.Factory] 20 | - classes: 21 | - exporter 22 | name: NewFactory 23 | parameters: 24 | return_types: [exporter.Factory] 25 | - classes: 26 | - extension 27 | name: NewFactory 28 | parameters: 29 | return_types: [extension.Factory] 30 | - classes: 31 | - processor 32 | name: NewFactory 33 | parameters: 34 | return_types: [processor.Factory] 35 | - classes: 36 | - receiver 37 | name: NewFactory 38 | parameters: 39 | return_types: [receiver.Factory] 40 | - classes: 41 | - pkg 42 | name: "*" 43 | 44 | ignored_functions: 45 | - ^Test.* 46 | - ^Benchmark.* 47 | - ^Fuzz.* 48 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configcallreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package configreceiver 5 | 6 | import "go.opentelemetry.io/collector/component" 7 | 8 | func createDefaultConfig() component.Config { 9 | return actuallyCreateConfig() 10 | } 11 | 12 | func actuallyCreateConfig() component.Config { 13 | fooStr := "foo" 14 | return &Config{ 15 | Foo: []string{"foo"}, 16 | Sub: SubConfig{ 17 | Foo: fooStr, 18 | Bar: false, 19 | Sub2: SubConfig2{ 20 | FooBar: "foobar", 21 | }, 22 | }, 23 | } 24 | } 25 | 26 | type Config struct { 27 | Foo []string 28 | Bar map[string]string 29 | Bool bool 30 | StrChan chan string 31 | Sub SubConfig 32 | Ptr *PtrStruct 33 | // Embedded struct 34 | Embedded 35 | // Embedded struct pointer 36 | *EmbeddedPtr 37 | } 38 | 39 | type PtrStruct struct { 40 | Field string 41 | } 42 | 43 | type SubConfig struct { 44 | Foo string 45 | Bar bool 46 | Sub2 SubConfig2 47 | } 48 | 49 | type SubConfig2 struct { 50 | FooBar string 51 | } 52 | 53 | type Embedded struct { 54 | Foo string 55 | } 56 | 57 | type EmbeddedPtr struct { 58 | Foo string 59 | } 60 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/multiple_changelogs/CHANGELOG-API.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `receiver/foo`: Some change relevant to [api] (#125) 10 | - `receiver/foo`: Some change relevant to [user,api] (#11) 11 | 12 | ### 🚩 Deprecations 🚩 13 | 14 | - `receiver/foo`: Some change relevant to [api] (#223) 15 | - `receiver/foo`: Some change relevant to [user,api] (#234) 16 | 17 | ### 💡 Enhancements 💡 18 | 19 | - `receiver/foo`: Some change relevant to [api,user] (#333) 20 | - `receiver/foo`: Some change relevant to [api] (#555) 21 | 22 | ### 🧰 Bug fixes 🧰 23 | 24 | - `receiver/foo`: Some change relevant to [api] (#111) 25 | - `receiver/foo`: Some change relevant to [api] (#777) 26 | 27 | ## v0.44.0 28 | 29 | ### 🛑 Breaking changes 🛑 30 | 31 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 32 | 33 | ### 💡 Enhancements 💡 34 | 35 | - `filterprocessor`: Ability to filter `Spans` (#6341) 36 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 37 | 38 | ### 🧰 Bug fixes 🧰 39 | 40 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 41 | -------------------------------------------------------------------------------- /internal/syncerror/known_sync_error_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //go:build windows 16 | 17 | // Package syncerror provides functionality to encapsulate synchronization 18 | // errors. 19 | package syncerror 20 | 21 | import ( 22 | "errors" 23 | 24 | "golang.org/x/sys/windows" 25 | ) 26 | 27 | // KnownSyncError returns true if the given error is one of the known 28 | // non-actionable errors returned by Sync on Windows: 29 | // 30 | // - sync /dev/stderr: The handle is invalid. 31 | func KnownSyncError(err error) bool { 32 | return errors.Is(err, windows.ERROR_INVALID_HANDLE) 33 | } 34 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/multiple_changelogs_single_default/CHANGELOG-API.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `receiver/foo`: Some change relevant to [api] (#125) 10 | - `receiver/foo`: Some change relevant to [user,api] (#11) 11 | 12 | ### 🚩 Deprecations 🚩 13 | 14 | - `receiver/foo`: Some change relevant to [api] (#223) 15 | - `receiver/foo`: Some change relevant to [user,api] (#234) 16 | 17 | ### 💡 Enhancements 💡 18 | 19 | - `receiver/foo`: Some change relevant to [api,user] (#333) 20 | - `receiver/foo`: Some change relevant to [api] (#555) 21 | 22 | ### 🧰 Bug fixes 🧰 23 | 24 | - `receiver/foo`: Some change relevant to [api] (#111) 25 | - `receiver/foo`: Some change relevant to [api] (#777) 26 | 27 | ## v0.44.0 28 | 29 | ### 🛑 Breaking changes 🛑 30 | 31 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 32 | 33 | ### 💡 Enhancements 💡 34 | 35 | - `filterprocessor`: Ability to filter `Spans` (#6341) 36 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 37 | 38 | ### 🧰 Bug fixes 🧰 39 | 40 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 41 | -------------------------------------------------------------------------------- /gotmpl/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // gotmpl is a tool to generate files from [text/template] and JSON data. 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "os" 21 | 22 | flag "github.com/spf13/pflag" 23 | ) 24 | 25 | var ( 26 | body = flag.StringP("body", "b", "", "Template body filepath.") 27 | data = flag.StringP("data", "d", "", "Data in JSON format.") 28 | out = flag.StringP("out", "o", "", "Output filepath.") 29 | ) 30 | 31 | func main() { 32 | flag.Parse() 33 | 34 | if err := gotmpl(*body, *data, *out); err != nil { 35 | fmt.Println(err) 36 | flag.PrintDefaults() 37 | os.Exit(1) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /multimod/internal/prerelease/test_data/update_all_version_go/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v2.2.2 26 | modules: 27 | - go.opentelemetry.io/testroot/v2 28 | excluded-modules: 29 | - go.opentelemetry.io/test/testexcluded 30 | modules: 31 | go.opentelemetry.io/test/test1: 32 | version-refs: 33 | - ./version.go 34 | - ./internal/version/distro.go 35 | -------------------------------------------------------------------------------- /multimod/internal/sync/test_data/new_sync/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | my-mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test/test1 20 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test/test2 21 | my-mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test3 25 | my-mod-set-3: 26 | version: v2.2.2 27 | modules: 28 | - go.opentelemetry.io/build-tools/multimod/internal/sync/testroot/v2 29 | excluded-modules: 30 | - go.opentelemetry.io/my/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/tag/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tag 16 | 17 | import ( 18 | "fmt" 19 | "strings" 20 | 21 | "github.com/go-git/go-git/v5/plumbing" 22 | ) 23 | 24 | type errGitTagsNotOnCommit struct { 25 | commitHash plumbing.Hash 26 | tagNames []string 27 | } 28 | 29 | func (e *errGitTagsNotOnCommit) Error() string { 30 | return fmt.Sprintf("some git tags are not on commit %s:\n%s", e.commitHash, strings.Join(e.tagNames, "\n")) 31 | } 32 | 33 | type errCouldNotGetCommitHash struct { 34 | err error 35 | } 36 | 37 | func (e *errCouldNotGetCommitHash) Error() string { 38 | return fmt.Sprintf("error getting full hash: %v", e.err) 39 | } 40 | -------------------------------------------------------------------------------- /chloggen/internal/config/config.yaml: -------------------------------------------------------------------------------- 1 | # The directory that stores individual changelog entries. 2 | # Each entry is stored in a dedicated yaml file. 3 | # - 'chloggen new' will copy the 'template_yaml' to this directory as a new entry file. 4 | # - 'chloggen validate' will validate that all entry files are valid. 5 | # - 'chloggen update' will read and delete all entry files in this directory, and update 'changelog_md'. 6 | # Specify as relative path from root of repo. 7 | # (Optional) Default: .chloggen 8 | # entries_dir: 9 | 10 | # This file is used as the input for individual changelog entries. 11 | # Specify as relative path from root of repo. 12 | # (Optional) Default: .chloggen/TEMPLATE.yaml 13 | # template_yaml: 14 | 15 | # The CHANGELOG file or files to which 'chloggen update' will write new entries 16 | # (Optional) Default filename: CHANGELOG.md 17 | # change_logs: 18 | # default: CHANGELOG.md 19 | 20 | # The default change_log or change_logs to which an entry should be added. 21 | # If 'change_logs' is specified in this file, and no value is specified for 'default_change_logs', 22 | # then 'change_logs' MUST be specified in every entry file. 23 | # default_change_logs: [] 24 | 25 | # The component values accepted. If empty, any component value is accepted. 26 | # components: [] 27 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/get_dependencies/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/build-tools/multimod/internal/verify/test/test1 20 | - go.opentelemetry.io/build-tools/multimod/internal/verify/test/test2 21 | mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/build-tools/multimod/internal/verify/test3 25 | mod-set-3: 26 | version: v0.2.0 27 | modules: 28 | - go.opentelemetry.io/build-tools/multimod/internal/verify/testroot 29 | excluded-modules: 30 | - go.opentelemetry.io/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/verify_dependencies/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/build-tools/multimod/internal/verify/test/test1 20 | - go.opentelemetry.io/build-tools/multimod/internal/verify/test/test2 21 | mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/build-tools/multimod/internal/verify/test3 25 | mod-set-3: 26 | version: v0.2.0 27 | modules: 28 | - go.opentelemetry.io/build-tools/multimod/internal/verify/testroot 29 | excluded-modules: 30 | - go.opentelemetry.io/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/sync/test_data/update_all_go_mod_files/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | my-mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test/test1 20 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test/test2 21 | my-mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test3 25 | my-mod-set-3: 26 | version: v2.2.2 27 | modules: 28 | - go.opentelemetry.io/build-tools/multimod/internal/sync/testroot/v2 29 | excluded-modules: 30 | - go.opentelemetry.io/my/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/sync/test_data/update_all_go_mod_files_with_commit_hash/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | my-mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test/test1 20 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test/test2 21 | my-mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/build-tools/multimod/internal/sync/test3 25 | my-mod-set-3: 26 | version: v2.2.2 27 | modules: 28 | - go.opentelemetry.io/build-tools/multimod/internal/sync/testroot/v2 29 | excluded-modules: 30 | - go.opentelemetry.io/my/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/prerelease/test_data/update_all_go_mod_files/versions_valid.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/build-tools/multimod/internal/prerelease/test/test1 20 | - go.opentelemetry.io/build-tools/multimod/internal/prerelease/test/test2 21 | mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/build-tools/multimod/internal/prerelease/test3 25 | mod-set-3: 26 | version: v0.2.0 27 | modules: 28 | - go.opentelemetry.io/build-tools/multimod/internal/prerelease/testroot 29 | excluded-modules: 30 | - go.opentelemetry.io/my/test/testexcluded 31 | -------------------------------------------------------------------------------- /multimod/internal/verify/test_data/verify_versions/multiple_sets_same_major.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v1.2.3-RC1+meta 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | mod-set-2: 21 | version: v0.1.0 22 | modules: 23 | - go.opentelemetry.io/test2 24 | mod-set-3: 25 | version: v1.0.0 26 | modules: 27 | - go.opentelemetry.io/test4 28 | mod-set-4: 29 | version: v1.9.9 30 | modules: 31 | - go.opentelemetry.io/test5 32 | mod-set-5: 33 | version: v2.1.2 34 | modules: 35 | - go.opentelemetry.io/test6 36 | mod-set-6: 37 | version: v2.1.2 38 | modules: 39 | - go.opentelemetry.io/test7 40 | excluded-modules: 41 | - go.opentelemetry.io/test/testexcluded 42 | -------------------------------------------------------------------------------- /checkapi/main_windows_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package main 5 | 6 | import ( 7 | "path/filepath" 8 | "testing" 9 | 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | func TestValidPkg(t *testing.T) { 14 | err := run(filepath.Join("internal", "testpkg"), "config.yaml") 15 | require.NoError(t, err) 16 | } 17 | 18 | func TestBadPkg(t *testing.T) { 19 | err := run(filepath.Join("internal", "badpkg"), "config.yaml") 20 | require.ErrorContains(t, err, "no function matching configuration found") 21 | } 22 | 23 | func TestAltConfig(t *testing.T) { 24 | err := run(filepath.Join("internal", "altpkg"), filepath.Join("internal", "altpkg", "config.yaml")) 25 | require.NoError(t, err) 26 | } 27 | 28 | func TestAltConfigWithOriginalConfig(t *testing.T) { 29 | err := run(filepath.Join("internal", "altpkg"), "config.yaml") 30 | require.ErrorContains(t, err, "[internal\\altpkg\\receiver\\altreceiver] no function matching configuration found\n[internal\\altpkg\\receiver\\badreceiver] no function matching configuration found") 31 | } 32 | 33 | func TestUnkeyedPkg(t *testing.T) { 34 | t.Chdir(filepath.Join("internal", "unkeyedpkg")) 35 | err := run(".", filepath.Join("..", "..", "config.yaml")) 36 | require.EqualError(t, err, `[receiver\unkeyedreceiver] struct "UnkeyedConfig" does not prevent unkeyed literal initialization`) 37 | } 38 | -------------------------------------------------------------------------------- /issuegenerator/internal/report/report.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package report handles [Report] generation via the [Generator]. 16 | package report 17 | 18 | import "strings" 19 | 20 | // Report on failing tests. 21 | type Report struct { 22 | Module string 23 | FailedTests map[string]string 24 | } 25 | 26 | // FailedTestsMD returns information about failed tests if available, otherwise 27 | // an empty string. 28 | func (r *Report) FailedTestsMD() string { 29 | if len(r.FailedTests) == 0 { 30 | return "" 31 | } 32 | 33 | var sb strings.Builder 34 | sb.WriteString("#### Test Failures\n") 35 | 36 | for testName, testError := range r.FailedTests { 37 | sb.WriteString("- `" + testName + "`\n```\n" + testError + "\n```\n") 38 | } 39 | 40 | return sb.String() 41 | } 42 | -------------------------------------------------------------------------------- /chloggen/internal/chlog/summary.tmpl: -------------------------------------------------------------------------------- 1 | {{- define "entry" -}} 2 | - `{{ .Component }}`: {{ .Note }} ( 3 | {{- range $i, $issue := .Issues }} 4 | {{- if $i }}, {{ end -}} 5 | #{{ $issue }} 6 | {{- end -}} 7 | ) 8 | 9 | {{- if .SubText }} 10 | {{ .SubText | indent 2 }} 11 | {{- end }} 12 | {{- end }} 13 | ## {{ .Version }} 14 | 15 | {{- if .BreakingChanges }} 16 | 17 | ### 🛑 Breaking changes 🛑 18 | 19 | {{- range $i, $change := .BreakingChanges }} 20 | {{- if eq $i 0}} 21 | {{end}} 22 | {{ template "entry" $change }} 23 | {{- end }} 24 | {{- end }} 25 | 26 | {{- if .Deprecations }} 27 | 28 | ### 🚩 Deprecations 🚩 29 | 30 | {{- range $i, $change := .Deprecations }} 31 | {{- if eq $i 0}} 32 | {{end}} 33 | {{ template "entry" $change }} 34 | {{- end }} 35 | {{- end }} 36 | 37 | {{- if .NewComponents }} 38 | 39 | ### 🚀 New components 🚀 40 | 41 | {{- range $i, $change := .NewComponents }} 42 | {{- if eq $i 0}} 43 | {{end}} 44 | {{ template "entry" $change }} 45 | {{- end }} 46 | {{- end }} 47 | 48 | {{- if .Enhancements }} 49 | 50 | ### 💡 Enhancements 💡 51 | 52 | {{- range $i, $change := .Enhancements }} 53 | {{- if eq $i 0}} 54 | {{end}} 55 | {{ template "entry" $change }} 56 | {{- end }} 57 | {{- end }} 58 | 59 | {{- if .BugFixes }} 60 | 61 | ### 🧰 Bug fixes 🧰 62 | 63 | {{- range $i, $change := .BugFixes }} 64 | {{- if eq $i 0}} 65 | {{end}} 66 | {{ template "entry" $change }} 67 | {{- end }} 68 | {{- end }} 69 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL Analysis" 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | # ┌───────────── minute (0 - 59) 7 | # │ ┌───────────── hour (0 - 23) 8 | # │ │ ┌───────────── day of the month (1 - 31) 9 | # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) 10 | # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) 11 | # │ │ │ │ │ 12 | # │ │ │ │ │ 13 | # │ │ │ │ │ 14 | # * * * * * 15 | - cron: '30 1 * * *' 16 | 17 | permissions: 18 | contents: read 19 | 20 | jobs: 21 | CodeQL-Build: 22 | permissions: 23 | security-events: write # required for uploading SARIF results 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 29 | 30 | # Initializes the CodeQL tools for scanning. 31 | - name: Initialize CodeQL 32 | uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 33 | with: 34 | languages: go 35 | 36 | - name: Autobuild 37 | uses: github/codeql-action/autobuild@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 38 | 39 | - name: Perform CodeQL Analysis 40 | uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 41 | 42 | -------------------------------------------------------------------------------- /get_main_pkgs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright The OpenTelemetry Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -euo pipefail 18 | 19 | top_dir='.' 20 | if [[ $# -gt 0 ]]; then 21 | top_dir="${1}" 22 | fi 23 | 24 | p=$(pwd) 25 | mod_dirs=() 26 | 27 | # Note `mapfile` does not exist in older bash versions: 28 | # https://stackoverflow.com/questions/41475261/need-alternative-to-readarray-mapfile-for-script-on-older-version-of-bash 29 | 30 | while IFS= read -r line; do 31 | mod_dirs+=("$line") 32 | done < <(find "${top_dir}" -type f -name 'go.mod' -exec dirname {} \; | sort) 33 | 34 | for mod_dir in "${mod_dirs[@]}"; do 35 | cd "${mod_dir}" 36 | 37 | while IFS= read -r line; do 38 | echo ".${line#${p}}" 39 | done < <(go list --find -f '{{.Name}}|{{.Dir}}' ./... | grep '^main|' | cut -f 2- -d '|') 40 | cd "${p}" 41 | done 42 | -------------------------------------------------------------------------------- /multimod/internal/shared/test_data/alt_version_files/versions.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | mod-set-1: 17 | version: v0.0.1 18 | modules: 19 | - go.opentelemetry.io/test/test1 20 | - go.opentelemetry.io/test/test2 21 | mod-set-2: 22 | version: v0.1.0 23 | modules: 24 | - go.opentelemetry.io/test3 25 | excluded-modules: 26 | - go.opentelemetry.io/excluded1 27 | modules: 28 | go.opentelemetry.io/test/test1: 29 | version-refs: 30 | - ./versions.go 31 | - ./internal/version/versions.go 32 | go.opentelemetry.io/test/test2: 33 | version-refs: 34 | - ./internal/deeper/version/versions.go 35 | go.opentelemetry.io/excluded1: 36 | version-refs: 37 | - ./sub/pkg/version/versions.go 38 | go.opentelemetry.io/unknown: 39 | version-refs: 40 | - ../unknown/versions.go 41 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/multiple_changelogs_multiple_defaults/CHANGELOG-API.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `receiver/foo`: Some change relevant to [api] (#125) 10 | - `receiver/foo`: Some change relevant to [user,api] (#11) 11 | 12 | ### 🚩 Deprecations 🚩 13 | 14 | - `receiver/foo`: Some change relevant to [default] (#123) 15 | - `receiver/foo`: Some change relevant to [api] (#223) 16 | - `receiver/foo`: Some change relevant to [user,api] (#234) 17 | 18 | ### 💡 Enhancements 💡 19 | 20 | - `receiver/foo`: Some change relevant to [default] (#21) 21 | - `receiver/foo`: Some change relevant to [api,user] (#333) 22 | - `receiver/foo`: Some change relevant to [api] (#555) 23 | 24 | ### 🧰 Bug fixes 🧰 25 | 26 | - `receiver/foo`: Some change relevant to [default] (#32) 27 | - `receiver/foo`: Some change relevant to [default] (#222) 28 | - `receiver/foo`: Some change relevant to [api] (#111) 29 | - `receiver/foo`: Some change relevant to [api] (#777) 30 | 31 | ## v0.44.0 32 | 33 | ### 🛑 Breaking changes 🛑 34 | 35 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 36 | 37 | ### 💡 Enhancements 💡 38 | 39 | - `filterprocessor`: Ability to filter `Spans` (#6341) 40 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 41 | 42 | ### 🧰 Bug fixes 🧰 43 | 44 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 45 | -------------------------------------------------------------------------------- /checkapi/internal/jsonschema_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package internal 5 | 6 | import ( 7 | "testing" 8 | 9 | "github.com/kaptinlin/jsonschema" 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestCompareSchemas(t *testing.T) { 14 | for _, test := range []struct { 15 | name string 16 | before *jsonschema.Schema 17 | after *jsonschema.Schema 18 | error string 19 | }{ 20 | { 21 | name: "identical, one field", 22 | before: jsonschema.Object(jsonschema.Prop("foo", jsonschema.String())), 23 | after: jsonschema.Object(jsonschema.Prop("foo", jsonschema.String())), 24 | }, 25 | { 26 | name: "different name, one field", 27 | before: jsonschema.Object(jsonschema.Prop("foo", jsonschema.String())), 28 | after: jsonschema.Object(jsonschema.Prop("bar", jsonschema.String())), 29 | error: `field "foo" is missing`, 30 | }, 31 | { 32 | name: "different, different type", 33 | before: jsonschema.Object(jsonschema.Prop("foo", jsonschema.String())), 34 | after: jsonschema.Object(jsonschema.Prop("foo", jsonschema.Boolean())), 35 | error: `field "foo" type changed`, 36 | }, 37 | } { 38 | t.Run(test.name, func(t *testing.T) { 39 | err := CompareJSONSchema("", test.before, test.after) 40 | if test.error != "" { 41 | assert.ErrorContains(t, err, test.error) 42 | } else { 43 | assert.NoError(t, err) 44 | } 45 | 46 | }) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /chloggen/cmd/testdata/all_change_types_multiple/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## v0.45.0 6 | 7 | ### 🛑 Breaking changes 🛑 8 | 9 | - `processor/oops`: Change behavior when ... (#12350) 10 | - `processor/oops`: Change behavior when ... (#12350) 11 | - foo 12 | - bar 13 | - blah 14 | - 1234567 15 | - `processor/oops`: Change behavior when ... (#12350) 16 | - `processor/oops`: Change behavior when ... (#12350) 17 | - foo 18 | - bar 19 | - blah 20 | - 1234567 21 | 22 | ### 🚩 Deprecations 🚩 23 | 24 | - `exporter/old`: Deprecate old (#12348) 25 | - `exporter/old`: Deprecate old (#12348) 26 | 27 | ### 🚀 New components 🚀 28 | 29 | - `exporter/new`: Add new exporter ... (#12349) 30 | - `exporter/new`: Add new exporter ... (#12349) 31 | 32 | ### 💡 Enhancements 💡 33 | 34 | - `receiver/foo`: Add some bar (#12345) 35 | - `receiver/foo`: Add some bar (#12345) 36 | 37 | ### 🧰 Bug fixes 🧰 38 | 39 | - `testbed`: Fix blah (#12346, #12347) 40 | - `testbed`: Fix blah (#12346, #12347) 41 | 42 | ## v0.44.0 43 | 44 | ### 🛑 Breaking changes 🛑 45 | 46 | - `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950) 47 | 48 | ### 💡 Enhancements 💡 49 | 50 | - `filterprocessor`: Ability to filter `Spans` (#6341) 51 | - `flinkmetricsreceiver`: add attribute values to metadata #11520 52 | 53 | ### 🧰 Bug fixes 🧰 54 | 55 | - `redactionprocessor`: respect allow_all_keys configuration (#11542) 56 | -------------------------------------------------------------------------------- /chloggen/internal/chlog/testdata/custom.tmpl: -------------------------------------------------------------------------------- 1 | {{- define "entry" -}} 2 | - `{{ .Component }}`: {{ .Note }} ( 3 | {{- range $i, $issue := .Issues }} 4 | {{- if $i }}, {{ end -}} 5 | [#{{ $issue }}](https://github.com/open-telemetry/opentelemetry-go-build-tools/issues/{{ $issue }}) 6 | {{- end -}} 7 | ) 8 | 9 | {{- if .SubText }} 10 | {{ .SubText | indent 2 }} 11 | {{- end }} 12 | {{- end }} 13 | ## {{ .Version }} 14 | 15 | {{- if .BreakingChanges }} 16 | 17 | ### 🛑 Breaking changes 🛑 18 | 19 | {{- range $i, $change := .BreakingChanges }} 20 | {{- if eq $i 0}} 21 | {{end}} 22 | {{ template "entry" $change }} 23 | {{- end }} 24 | {{- end }} 25 | 26 | {{- if .Deprecations }} 27 | 28 | ### 🚩 Deprecations 🚩 29 | 30 | {{- range $i, $change := .Deprecations }} 31 | {{- if eq $i 0}} 32 | {{end}} 33 | {{ template "entry" $change }} 34 | {{- end }} 35 | {{- end }} 36 | 37 | {{- if .NewComponents }} 38 | 39 | ### 🚀 New components 🚀 40 | 41 | {{- range $i, $change := .NewComponents }} 42 | {{- if eq $i 0}} 43 | {{end}} 44 | {{ template "entry" $change }} 45 | {{- end }} 46 | {{- end }} 47 | 48 | {{- if .Enhancements }} 49 | 50 | ### 💡 Enhancements 💡 51 | 52 | {{- range $i, $change := .Enhancements }} 53 | {{- if eq $i 0}} 54 | {{end}} 55 | {{ template "entry" $change }} 56 | {{- end }} 57 | {{- end }} 58 | 59 | {{- if .BugFixes }} 60 | 61 | ### 🧰 Bug fixes 🧰 62 | 63 | {{- range $i, $change := .BugFixes }} 64 | {{- if eq $i 0}} 65 | {{end}} 66 | {{ template "entry" $change }} 67 | {{- end }} 68 | {{- end }} 69 | -------------------------------------------------------------------------------- /dbotconf/README.md: -------------------------------------------------------------------------------- 1 | # dbotconf 2 | 3 | ## Overview 4 | 5 | `dbotconf` is a Go-based tool designed to assist with configuration management 6 | of the dependabot system. It is part of the OpenTelemetry build-tools suite. 7 | 8 | ## Installation 9 | 10 | To install `dbotconf`, ensure you have Go installed and run: 11 | 12 | ```bash 13 | go install go.opentelemetry.io/build-tools/dbotconf@latest 14 | ``` 15 | 16 | ## Usage 17 | 18 | ```terminal 19 | dbotconf manages Dependabot configuration for multi-module Go repositories. 20 | 21 | Usage: 22 | dbotconf [command] 23 | 24 | Examples: 25 | 26 | dbotconf generate > .github/dependabot.yml 27 | 28 | dbotconf verify .github/dependabot.yml 29 | 30 | Available Commands: 31 | completion Generate the autocompletion script for the specified shell 32 | generate Generate Dependabot configuration 33 | help Help about any command 34 | verify Verify Dependabot configuration is complete 35 | 36 | Flags: 37 | -h, --help help for dbotconf 38 | --ignore strings glob patterns to ignore 39 | 40 | Use "dbotconf [command] --help" for more information about a command. 41 | ``` 42 | 43 | The `generate` command creates configuration files based on predefined templates. 44 | 45 | ```bash 46 | dbotconf generate 47 | ``` 48 | 49 | The `verify` command checks the validity of existing configuration files. 50 | 51 | ```bash 52 | dbotconf verify 53 | ``` 54 | 55 | ## License 56 | 57 | This project is licensed under the Apache License 2.0. 58 | -------------------------------------------------------------------------------- /internal/syncerror/known_sync_error.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //go:build !windows 16 | 17 | // Package syncerror provides functionality to encapsulate synchronization 18 | // errors. 19 | package syncerror 20 | 21 | import ( 22 | "errors" 23 | "syscall" 24 | ) 25 | 26 | var knownSyncErrors = []error{ 27 | // sync /dev/stdout: invalid argument 28 | syscall.EINVAL, 29 | // sync /dev/stdout: not supported 30 | syscall.ENOTSUP, 31 | // sync /dev/stdout: inappropriate ioctl for device 32 | syscall.ENOTTY, 33 | // sync /dev/stdout: bad file descriptor 34 | syscall.EBADF, 35 | } 36 | 37 | // KnownSyncError returns true if the given error is one of the known 38 | // non-actionable errors returned by Sync on Linux and macOS. 39 | func KnownSyncError(err error) bool { 40 | for _, syncError := range knownSyncErrors { 41 | if errors.Is(err, syncError) { 42 | return true 43 | } 44 | } 45 | 46 | return false 47 | } 48 | -------------------------------------------------------------------------------- /githubgen/README.md: -------------------------------------------------------------------------------- 1 | # githubgen 2 | 3 | This executable is used to generate `.github/CODEOWNERS` and 4 | `.github/ALLOWLIST` files. 5 | 6 | It reads status metadata from `metadata.yaml` files located throughout the 7 | repository. 8 | 9 | It checks that codeowners are known members of the OpenTelemetry organization. 10 | 11 | ## Usage 12 | 13 | ```shell 14 | $> ./githubgen 15 | ``` 16 | 17 | The equivalent of: 18 | 19 | ```shell 20 | $> githubgen --skipgithub --folder . --github-org "open-telemetry" \ 21 | --default-codeowner open-telemetry/opentelemetry-collector-approvers \ 22 | --allowlist cmd/githubgen/allowlist.txt 23 | ``` 24 | 25 | ## Checking codeowners against OpenTelemetry membership via GitHub API 26 | 27 | To authenticate, set the environment variable `GITHUB_TOKEN` to a PAT token. 28 | If a PAT is not available you can use the `--skipgithub` flag to avoid checking 29 | for membership in the GitHub organization. 30 | 31 | Additionally, the GitHub organization name needs to be specified using 32 | `--github-org `, along with `--default-codeowner` to be used as the 33 | default owner for general files. 34 | 35 | For each codeowner, the script will check if the user is registered as a member 36 | of the OpenTelemetry organization. 37 | 38 | If any codeowner is missing, it will stop and print names of missing codeowners. 39 | 40 | These can be added to allowlist.txt as a workaround. 41 | 42 | If a codeowner is present in `allowlist.txt` and also a member of the 43 | OpenTelemetry organization, the script will error out. 44 | -------------------------------------------------------------------------------- /dbotconf/internal/testdata/dependabot.yml: -------------------------------------------------------------------------------- 1 | # File generated by dbotconf; DO NOT EDIT. 2 | version: 2 3 | updates: 4 | - package-ecosystem: github-actions 5 | directory: / 6 | labels: 7 | - dependencies 8 | - actions 9 | - Skip Changelog 10 | schedule: 11 | interval: weekly 12 | day: sunday 13 | - package-ecosystem: docker 14 | directory: / 15 | labels: 16 | - dependencies 17 | - docker 18 | - Skip Changelog 19 | schedule: 20 | interval: weekly 21 | day: sunday 22 | - package-ecosystem: docker 23 | directory: /a/b/example 24 | labels: 25 | - dependencies 26 | - docker 27 | - Skip Changelog 28 | schedule: 29 | interval: weekly 30 | day: sunday 31 | - package-ecosystem: gomod 32 | directory: / 33 | labels: 34 | - dependencies 35 | - actions 36 | - Skip Changelog 37 | schedule: 38 | interval: weekly 39 | day: sunday 40 | - package-ecosystem: gomod 41 | directory: /a 42 | labels: 43 | - dependencies 44 | - actions 45 | - Skip Changelog 46 | schedule: 47 | interval: weekly 48 | day: sunday 49 | - package-ecosystem: gomod 50 | directory: /a/b 51 | labels: 52 | - dependencies 53 | - actions 54 | - Skip Changelog 55 | schedule: 56 | interval: weekly 57 | day: sunday 58 | - package-ecosystem: pip 59 | directory: / 60 | labels: 61 | - dependencies 62 | - python 63 | - Skip Changelog 64 | schedule: 65 | interval: weekly 66 | day: sunday 67 | -------------------------------------------------------------------------------- /dbotconf/internal/conf.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package internal 16 | 17 | const ( 18 | version2 = 2 19 | ghPkgEco = "github-actions" 20 | dockerPkgEco = "docker" 21 | gomodPkgEco = "gomod" 22 | pipPkgEco = "pip" 23 | ) 24 | 25 | var ( 26 | weeklySchedule = schedule{Interval: "weekly", Day: "sunday"} 27 | actionLabels = []string{"dependencies", "actions", "Skip Changelog"} 28 | dockerLabels = []string{"dependencies", "docker", "Skip Changelog"} 29 | goLabels = []string{"dependencies", "go", "Skip Changelog"} 30 | pipLabels = []string{"dependencies", "python", "Skip Changelog"} 31 | ) 32 | 33 | type dependabotConfig struct { 34 | Version int 35 | Updates []update 36 | } 37 | 38 | type update struct { 39 | PackageEcosystem string `yaml:"package-ecosystem"` 40 | Directory string 41 | Labels []string `yaml:",omitempty"` 42 | Schedule schedule 43 | } 44 | 45 | type schedule struct { 46 | Interval string 47 | Day string `yaml:",omitempty"` 48 | } 49 | -------------------------------------------------------------------------------- /multimod/cmd/verify.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "log" 19 | 20 | "github.com/spf13/cobra" 21 | 22 | "go.opentelemetry.io/build-tools/multimod/internal/verify" 23 | ) 24 | 25 | // verifyCmd represents the verify command 26 | var verifyCmd = &cobra.Command{ 27 | Use: "verify", 28 | Short: "Verifies that the versioning file is valid", 29 | Long: `verify checks that all modules listed in sets are valid by verifying the following properties: 30 | - All modules are contained in exactly one module set. 31 | - Versions conform to semver semantics. 32 | - No more than one set of modules exists for any non-zero major version. 33 | - Script warns if any stable modules depend on any unstable modules. 34 | `, 35 | Run: func(*cobra.Command, []string) { 36 | log.Println("Using versioning file", versioningFile) 37 | 38 | verify.Run(versioningFile) 39 | }, 40 | } 41 | 42 | func init() { 43 | // Plain log output, no timestamps. 44 | log.SetFlags(0) 45 | 46 | rootCmd.AddCommand(verifyCmd) 47 | } 48 | -------------------------------------------------------------------------------- /internal/syncerror/known_sync_error_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //go:build !windows 16 | 17 | package syncerror 18 | 19 | import ( 20 | "errors" 21 | "syscall" 22 | "testing" 23 | 24 | "github.com/stretchr/testify/assert" 25 | ) 26 | 27 | func TestKnownSyncError(t *testing.T) { 28 | tests := []struct { 29 | testName string 30 | assertion assert.BoolAssertionFunc 31 | errorValue error 32 | }{ 33 | { 34 | testName: "einval", 35 | assertion: assert.True, 36 | errorValue: syscall.EINVAL, 37 | }, 38 | { 39 | testName: "enotsup", 40 | assertion: assert.True, 41 | errorValue: syscall.ENOTSUP, 42 | }, 43 | { 44 | testName: "enotty", 45 | assertion: assert.True, 46 | errorValue: syscall.EBADF, 47 | }, 48 | { 49 | testName: "fake error", 50 | assertion: assert.False, 51 | errorValue: errors.New("invalid error"), 52 | }, 53 | } 54 | for _, test := range tests { 55 | t.Run(test.testName, func(t *testing.T) { 56 | test.assertion(t, KnownSyncError(test.errorValue)) 57 | }) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /.github/workflows/ossf-scorecard.yml: -------------------------------------------------------------------------------- 1 | name: OSSF Scorecard 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | schedule: 8 | - cron: "2 4 * * 2" # once a week 9 | workflow_dispatch: 10 | 11 | permissions: read-all 12 | 13 | jobs: 14 | analysis: 15 | runs-on: ubuntu-latest 16 | permissions: 17 | # Needed for Code scanning upload 18 | security-events: write 19 | # Needed for GitHub OIDC token if publish_results is true 20 | id-token: write 21 | steps: 22 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 23 | with: 24 | persist-credentials: false 25 | 26 | - uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 27 | with: 28 | results_file: results.sarif 29 | results_format: sarif 30 | publish_results: true 31 | 32 | # Upload the results as artifacts (optional). Commenting out will disable 33 | # uploads of run results in SARIF format to the repository Actions tab. 34 | # https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts 35 | - name: "Upload artifact" 36 | uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 37 | with: 38 | name: SARIF file 39 | path: results.sarif 40 | retention-days: 5 41 | 42 | # Upload the results to GitHub's code scanning dashboard (optional). 43 | # Commenting out will disable upload of results to your repo's Code Scanning dashboard 44 | - name: "Upload to code-scanning" 45 | uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 46 | with: 47 | sarif_file: results.sarif 48 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Release Process 2 | 3 | ## Pre-Release 4 | 5 | 1. Create a new release branch. I.e. `git checkout -b release-X.X.X main`. 6 | 7 | 1. Update the version in [`versions.yaml`](versions.yaml) and commit the change. 8 | 9 | 1. Run the pre-release steps which updates `go.mod` and `version.go` files 10 | in modules for the new release. 11 | 12 | ```sh 13 | make multimod-prerelease 14 | ``` 15 | 16 | 1. Merge the branch created by `multimod` into your release branch. 17 | 18 | 1. Update `go.mod` and `go.sum` files. 19 | 20 | ```sh 21 | make tidy 22 | ``` 23 | 24 | 1. Update [CHANGELOG.md](CHANGELOG.md) with new the new release. 25 | 26 | ```sh 27 | make chlog-update VERSION= 28 | ``` 29 | 30 | 1. Push the changes and create a Pull Request on GitHub. 31 | 32 | ## Tag 33 | 34 | Once the Pull Request with all the version changes has been approved 35 | and merged it is time to tag the merged commit. 36 | 37 | ***IMPORTANT***: It is critical you use the crrect commit 38 | that was pushed in the Pre-Release step! 39 | Failure to do so will leave things in a broken state. 40 | 41 | ***IMPORTANT***: 42 | [There is currently no way to remove an incorrectly tagged version of a Go module](https://github.com/golang/go/issues/34189). 43 | It is critical you make sure the version you push upstream is correct. 44 | [Failure to do so will lead to minor emergencies and tough to work around](https://github.com/open-telemetry/opentelemetry-go/issues/331). 45 | 46 | ```sh 47 | make push-tags REMOTE= COMMIT= 48 | ``` 49 | 50 | ## Release 51 | 52 | Create a Release for the new `` on GitHub. 53 | The release body should include all the release notes 54 | for this release taken from [CHANGELOG.md](CHANGELOG.md). 55 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.yml: -------------------------------------------------------------------------------- 1 | name: Enhancement 2 | description: Suggest an enhancement 3 | labels: [enhancement] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thank you for suggesting an enhancement! 9 | - type: dropdown 10 | id: component 11 | attributes: 12 | label: Component(s) 13 | description: Which tool(s) or component(s) are related? (Select all that apply) 14 | multiple: true 15 | options: 16 | - checkapi 17 | - checkfile 18 | - chloggen 19 | - crosslink 20 | - dbotconf 21 | - githubgen 22 | - gotmpl 23 | - internal 24 | - issuegenerator 25 | - multimod 26 | validations: 27 | required: false 28 | - type: textarea 29 | id: proposal 30 | attributes: 31 | label: Enhancement Proposal 32 | description: Describe your suggestion. 33 | validations: 34 | required: true 35 | - type: textarea 36 | id: motivation 37 | attributes: 38 | label: Motivation 39 | description: Why do you want this enhancement? 40 | validations: 41 | required: true 42 | - type: dropdown 43 | attributes: 44 | label: Tip 45 | description: This element is static, used to render a helpful sub-heading for end-users and community members to help prioritize issues. Please leave as is. 46 | options: 47 | - [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). 48 | default: 0 49 | -------------------------------------------------------------------------------- /githubgen/issuetemplates_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package main 5 | 6 | import "testing" 7 | 8 | func Test_folderToSlug(t *testing.T) { 9 | type args struct { 10 | folder string 11 | } 12 | tests := []struct { 13 | name string 14 | args args 15 | want string 16 | }{ 17 | { 18 | name: "special case", 19 | args: args{ 20 | folder: "internal/coreinternal", 21 | }, 22 | want: "internal/core", 23 | }, 24 | { 25 | name: "1", 26 | args: args{ 27 | folder: "processor/resourcedetectionprocessor/internal/aws/ec2", 28 | }, 29 | want: "processor/resourcedetection/internal/aws/ec2", 30 | }, 31 | { 32 | name: "2", 33 | args: args{ 34 | folder: "receiver/hostmetricsreceiver/internal/scraper/loadscraper", 35 | }, 36 | want: "receiver/hostmetrics/internal/scraper/loadscraper", 37 | }, 38 | { 39 | name: "3", 40 | args: args{ 41 | folder: "receiver/apachesparkreceiver", 42 | }, 43 | want: "receiver/apachespark", 44 | }, 45 | { 46 | name: "4", 47 | args: args{ 48 | folder: "testbed", 49 | }, 50 | want: "testbed", 51 | }, 52 | { 53 | name: "5", 54 | args: args{ 55 | folder: "processor/resourcedetectionprocessor/internal/aws/ec2", 56 | }, 57 | want: "processor/resourcedetection/internal/aws/ec2", 58 | }, 59 | } 60 | for _, tt := range tests { 61 | t.Run(tt.name, func(t *testing.T) { 62 | itg := &issueTemplatesGenerator{ 63 | trimSuffixes: []string{"receiver", "exporter", "extension", "processor", "connector", "internal"}, 64 | } 65 | if got := itg.folderToSlug(tt.args.folder); got != tt.want { 66 | t.Errorf("folderToSlug() = %v, want %v", got, tt.want) 67 | } 68 | }) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /chloggen/go.sum: -------------------------------------------------------------------------------- 1 | github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= 2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 5 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 6 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 7 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 8 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 9 | github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= 10 | github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= 11 | github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 12 | github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= 13 | github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 14 | github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 15 | github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 16 | go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= 17 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 18 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 19 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 20 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 21 | -------------------------------------------------------------------------------- /chloggen/cmd/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "os" 19 | 20 | "github.com/spf13/cobra" 21 | 22 | "go.opentelemetry.io/build-tools/chloggen/internal/chlog" 23 | ) 24 | 25 | func validateCmd() *cobra.Command { 26 | cmd := &cobra.Command{ 27 | Use: "validate", 28 | Short: "Validates the files in the changelog directory", 29 | RunE: func(cmd *cobra.Command, _ []string) error { 30 | if _, err := os.Stat(globalCfg.EntriesDir); err != nil { 31 | return err 32 | } 33 | 34 | entriesByChangelog, err := chlog.ReadEntries(globalCfg) 35 | if err != nil { 36 | return err 37 | } 38 | for _, entries := range entriesByChangelog { 39 | for _, entry := range entries { 40 | changelogRequired := len(globalCfg.DefaultChangeLogs) == 0 41 | validChangeLogs := []string{} 42 | for changeLogKey := range globalCfg.ChangeLogs { 43 | validChangeLogs = append(validChangeLogs, changeLogKey) 44 | } 45 | if err = entry.Validate(changelogRequired, globalCfg.Components, validChangeLogs...); err != nil { 46 | return err 47 | } 48 | } 49 | } 50 | cmd.Printf("PASS: all files in %s/ are valid\n", globalCfg.EntriesDir) 51 | return nil 52 | }, 53 | } 54 | return cmd 55 | } 56 | -------------------------------------------------------------------------------- /crosslink/internal/config.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package crosslink 16 | 17 | import ( 18 | "log" 19 | 20 | "go.uber.org/zap" 21 | "golang.org/x/mod/modfile" 22 | ) 23 | 24 | type moduleInfo struct { 25 | moduleContents modfile.File 26 | requiredReplaceStatements map[string]struct{} 27 | } 28 | 29 | func newModuleInfo(moduleContents modfile.File) *moduleInfo { 30 | return &moduleInfo{ 31 | requiredReplaceStatements: make(map[string]struct{}), 32 | moduleContents: moduleContents, 33 | } 34 | } 35 | 36 | // RunConfig is the crosslink configuration. 37 | type RunConfig struct { 38 | RootPath string 39 | Verbose bool 40 | ExcludedPaths map[string]struct{} 41 | SkippedPaths map[string]struct{} 42 | Overwrite bool 43 | Prune bool 44 | GoVersion string 45 | AllowCircular string 46 | Validate bool 47 | Logger *zap.Logger 48 | } 49 | 50 | // DefaultRunConfig returns a default RunConfig. 51 | func DefaultRunConfig() RunConfig { 52 | lg, err := zap.NewProduction() 53 | if err != nil { 54 | log.Printf("Could not create zap logger: %v", err) 55 | } 56 | ep := make(map[string]struct{}) 57 | rc := RunConfig{ 58 | Logger: lg, 59 | ExcludedPaths: ep, 60 | } 61 | return rc 62 | } 63 | -------------------------------------------------------------------------------- /.github/workflows/markdown.yml: -------------------------------------------------------------------------------- 1 | name: markdown 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | permissions: 8 | contents: read 9 | jobs: 10 | changedfiles: 11 | name: changed files 12 | runs-on: ubuntu-latest 13 | outputs: 14 | md: ${{ steps.changes.outputs.md }} 15 | steps: 16 | - name: Checkout Repo 17 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 18 | with: 19 | fetch-depth: 0 20 | - name: Get changed files 21 | id: changes 22 | run: | 23 | echo "md=$(git diff --name-only --diff-filter=ACMRTUXB origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)" >> $GITHUB_OUTPUT 24 | 25 | lint: 26 | name: lint markdown files 27 | runs-on: ubuntu-latest 28 | needs: changedfiles 29 | if: ${{needs.changedfiles.outputs.md}} 30 | steps: 31 | - name: Checkout Repo 32 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 33 | - name: Run linter 34 | uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee 35 | with: 36 | args: -i "/**/testdata" ${{needs.changedfiles.outputs.md}} 37 | ignore: 'CHANGELOG.md' 38 | 39 | check-links: 40 | runs-on: ubuntu-latest 41 | steps: 42 | - name: Checkout Repo 43 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 44 | with: 45 | fetch-depth: 0 46 | - uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1 47 | with: 48 | base-branch: 'main' 49 | use-quiet-mode: 'yes' 50 | use-verbose-mode: 'yes' 51 | config-file: '.markdown-link.json' 52 | check-modified-files-only: 'yes' 53 | folder-path: '' 54 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: File a bug report 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thank you for reporting a bug! 9 | - type: dropdown 10 | id: component 11 | attributes: 12 | label: Component 13 | description: Which tool or component is affected? 14 | multiple: true 15 | options: 16 | - checkapi 17 | - checkfile 18 | - chloggen 19 | - crosslink 20 | - dbotconf 21 | - githubgen 22 | - gotmpl 23 | - internal 24 | - issuegenerator 25 | - multimod 26 | validations: 27 | required: false 28 | - type: textarea 29 | id: description 30 | attributes: 31 | label: Bug Description 32 | description: Describe the bug. 33 | validations: 34 | required: true 35 | - type: textarea 36 | id: repro 37 | attributes: 38 | label: Steps To Reproduce 39 | description: Steps to reproduce the problem. 40 | validations: 41 | required: true 42 | - type: textarea 43 | id: expected 44 | attributes: 45 | label: Expected Behavior 46 | description: What did you expect to happen? 47 | validations: 48 | required: true 49 | - type: dropdown 50 | attributes: 51 | label: Tip 52 | description: This element is static, used to render a helpful sub-heading for end-users and community members to help prioritize issues. Please leave as is. 53 | options: 54 | - [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). 55 | default: 0 56 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= 5 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 6 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 7 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 8 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 9 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 10 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 11 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 12 | github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 13 | github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 14 | golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI= 15 | golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg= 16 | golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= 17 | golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= 18 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 19 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 20 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 21 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 22 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 23 | -------------------------------------------------------------------------------- /multimod/internal/shared/all_mod.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package shared // nolint:revive // keeping generic package name until a proper refactoring is done 16 | 17 | import ( 18 | "fmt" 19 | "io/fs" 20 | "os" 21 | "path/filepath" 22 | 23 | "golang.org/x/mod/modfile" 24 | ) 25 | 26 | func newAllModulePathMap(root string) (ModulePathMap, error) { 27 | modPathMap := make(ModulePathMap) 28 | 29 | findGoMod := func(filePath string, _ fs.FileInfo, err error) error { 30 | if err != nil { 31 | fmt.Printf("Warning: file could not be read during filepath.Walk(): %v", err) 32 | return nil 33 | } 34 | if filepath.Base(filePath) == "go.mod" { 35 | // read go.mod file into mod []byte 36 | mod, err := os.ReadFile(filepath.Clean(filePath)) 37 | if err != nil { 38 | return err 39 | } 40 | 41 | // read path of module from go.mod file 42 | modPathString := modfile.ModulePath(mod) 43 | 44 | // convert modPath, filePath string to modulePath and moduleFilePath 45 | modPath := ModulePath(modPathString) 46 | modFilePath := ModuleFilePath(filePath) 47 | 48 | modPathMap[modPath] = modFilePath 49 | } 50 | return nil 51 | } 52 | 53 | if err := filepath.Walk(root, findGoMod); err != nil { 54 | return nil, err 55 | } 56 | 57 | return modPathMap, nil 58 | } 59 | -------------------------------------------------------------------------------- /dbotconf/internal/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package internal provides internal functionality for the dbotconf package. 16 | package internal 17 | 18 | import ( 19 | "github.com/spf13/cobra" 20 | ) 21 | 22 | var ( 23 | rootCmd = &cobra.Command{ 24 | Use: "dbotconf", 25 | Short: "Dependabot configuration utility", 26 | Long: "dbotconf manages Dependabot configuration for multi-module Go repositories.", 27 | Example: ` 28 | dbotconf generate > .github/dependabot.yml 29 | 30 | dbotconf verify .github/dependabot.yml`, 31 | } 32 | 33 | generateCmd = &cobra.Command{ 34 | Use: "generate", 35 | Short: "Generate Dependabot configuration", 36 | Run: runGenerate, 37 | } 38 | 39 | verifyCmd = &cobra.Command{ 40 | Use: "verify [flags] path", 41 | Short: "Verify Dependabot configuration is complete", 42 | Long: "Ensure Dependabot configuration contains update checks for all modules in the repository.", 43 | Run: runVerify, 44 | } 45 | ) 46 | 47 | const ignoreFlag = "ignore" 48 | 49 | // BuildAndExecute runs the dbotconf command. 50 | func BuildAndExecute() error { 51 | rootCmd.AddCommand(generateCmd) 52 | rootCmd.AddCommand(verifyCmd) 53 | 54 | rootCmd.PersistentFlags().StringSlice(ignoreFlag, nil, "glob patterns to ignore") 55 | 56 | return rootCmd.Execute() 57 | } 58 | -------------------------------------------------------------------------------- /chloggen/cmd/root_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/stretchr/testify/assert" 21 | ) 22 | 23 | const rootUsage = `chloggen is a tool used to automate the generation of CHANGELOG files using individual yaml files as the source. 24 | 25 | Usage: 26 | chloggen [command] 27 | 28 | Available Commands: 29 | completion Generate the autocompletion script for the specified shell 30 | help Help about any command 31 | new Creates new change file 32 | update Updates CHANGELOG.MD to include all new changes 33 | validate Validates the files in the changelog directory 34 | 35 | Flags: 36 | --config string (optional) chloggen config file 37 | -h, --help help for chloggen 38 | 39 | Use "chloggen [command] --help" for more information about a command.` 40 | 41 | func TestRoot(t *testing.T) { 42 | var out string 43 | var err error 44 | 45 | out, err = runCobra(t) 46 | assert.Contains(t, out, rootUsage) 47 | assert.Empty(t, err) 48 | 49 | out, err = runCobra(t, "--help") 50 | assert.Contains(t, out, rootUsage) 51 | assert.Empty(t, err) 52 | 53 | out, err = runCobra(t, "--config", "foo.yaml") 54 | assert.Contains(t, out, rootUsage) 55 | assert.Empty(t, err) 56 | } 57 | 58 | func TestRepoRoot(t *testing.T) { 59 | assert.DirExists(t, repoRoot()) 60 | } 61 | -------------------------------------------------------------------------------- /multimod/cmd/diff.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package cmd 5 | 6 | import ( 7 | "log" 8 | "strings" 9 | 10 | "github.com/spf13/cobra" 11 | 12 | "go.opentelemetry.io/build-tools/internal/repo" 13 | "go.opentelemetry.io/build-tools/multimod/internal/diff" 14 | ) 15 | 16 | var previousVersion string 17 | 18 | var diffCmd = &cobra.Command{ 19 | Use: "diff", 20 | Short: "Determines if any files in a module have changed", 21 | Run: func(*cobra.Command, []string) { 22 | repoRoot, err := repo.FindRoot() 23 | if err != nil { 24 | log.Fatalf("could not find repo root: %v", err) 25 | } 26 | 27 | changedFiles, err := diff.HasChanged(repoRoot, versioningFile, previousVersion, moduleSetName) 28 | if err != nil { 29 | log.Fatalf("error running diff: %v", err) 30 | } 31 | 32 | if len(changedFiles) > 0 { 33 | log.Fatalf("The following files changed in %s modules since %s: \n%s\nRelease is required for %s modset", moduleSetName, previousVersion, strings.Join(changedFiles, "\n"), moduleSetName) 34 | } 35 | log.Printf("No %s modules have changed since %s", moduleSetName, previousVersion) 36 | }, 37 | } 38 | 39 | func init() { 40 | // Plain log output, no timestamps. 41 | log.SetFlags(0) 42 | 43 | rootCmd.AddCommand(diffCmd) 44 | diffCmd.Flags().StringVarP(&moduleSetName, "module-set-name", "m", "", 45 | "Name of module set being diff'd. "+ 46 | "Name must be listed in the module set versioning YAML. ", 47 | ) 48 | if err := diffCmd.MarkFlagRequired("module-set-name"); err != nil { 49 | log.Fatalf("could not mark module-set-name flag as required: %v", err) 50 | } 51 | 52 | diffCmd.Flags().StringVarP(&previousVersion, "previous-version", "p", "", 53 | "Previously released version."+ 54 | "Version must be a tag in the repository. ", 55 | ) 56 | if err := diffCmd.MarkFlagRequired("previous-version"); err != nil { 57 | log.Fatalf("could not mark previous-version flag as required: %v", err) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /multimod/internal/shared/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package shared // nolint:revive // keeping generic package name until a proper refactoring is done 16 | 17 | import ( 18 | "fmt" 19 | "strings" 20 | ) 21 | 22 | // ErrGitTagsAlreadyExist is an error that indicates that all git tags checked 23 | // already exist. 24 | type ErrGitTagsAlreadyExist struct { 25 | tagNames []string 26 | } 27 | 28 | // Error returns a string representation of the error. 29 | func (e ErrGitTagsAlreadyExist) Error() string { 30 | return fmt.Sprintf("all git tags checked already exist:\n%s", strings.Join(e.tagNames, "\n")) 31 | } 32 | 33 | // ErrInconsistentGitTagsExist is an error that indicates that some but not all 34 | // git tags checked exist. 35 | type ErrInconsistentGitTagsExist struct { 36 | tagNames []string 37 | } 38 | 39 | // Error returns a string representation of the error. 40 | func (e ErrInconsistentGitTagsExist) Error() string { 41 | return fmt.Sprintf("git tags inconsistent for module set (some but not all tags in module set):\n%s", strings.Join(e.tagNames, "\n")) 42 | } 43 | 44 | type errGetWorktreeFailed struct { 45 | reason error 46 | } 47 | 48 | func (e *errGetWorktreeFailed) Error() string { 49 | return fmt.Sprintf("failed to get worktree: %v", e.reason) 50 | } 51 | 52 | type errWorkingTreeNotClean struct{} 53 | 54 | func (e *errWorkingTreeNotClean) Error() string { 55 | return "working tree not clean" 56 | } 57 | -------------------------------------------------------------------------------- /checkapi/internal/config/receiver/configreceiver/code_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package configreceiver 5 | 6 | import ( 7 | "github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/configreceiver/emb" 8 | "go.opentelemetry.io/collector/component" 9 | ) 10 | 11 | func createDefaultConfig() component.Config { 12 | fooStr := "foo" 13 | return &Config{ 14 | Foo: []string{"foo"}, 15 | Sub: SubConfig{ 16 | Foo: fooStr, 17 | Bar: false, 18 | Sub2: SubConfig2{ 19 | FooBar: "foobar", 20 | }, 21 | }, 22 | } 23 | } 24 | 25 | type DataDefinedElsewhere string 26 | 27 | type Config struct { 28 | Foo []string `mapstructure:"foo"` 29 | Bar map[string]string `mapstructure:"bar"` 30 | Bool bool `mapstructure:"bool"` 31 | DefinedElsewhere DataDefinedElsewhere `mapstructure:"data_defined_elsewhere"` 32 | StrChan chan string 33 | Sub SubConfig `mapstructure:"subconfig"` 34 | Ptr *PtrStruct `mapstructure:"ptrStruct"` 35 | // Embedded struct 36 | emb.Config `mapstructure:",squash"` 37 | // Embedded struct pointer 38 | *EmbeddedPtr 39 | // Generic type 40 | Holder GenericHolder[GenericType] 41 | // Map holding types 42 | MapOfStructs map[Key]Value 43 | } 44 | 45 | type Key struct{} 46 | 47 | type Value struct{} 48 | 49 | type PtrStruct struct { 50 | Field string 51 | } 52 | 53 | type SubConfig struct { 54 | Foo string `mapstructure:"foo"` 55 | Bar bool `mapstructure:"bar"` 56 | Sub2 SubConfig2 `mapstructure:"sub_config2"` 57 | DefinedElsewhere DataDefinedElsewhere `mapstructure:",squash"` 58 | } 59 | 60 | type SubConfig2 struct { 61 | FooBar string `mapstructure:"foobar"` 62 | } 63 | 64 | type EmbeddedPtr struct { 65 | Foo string 66 | } 67 | 68 | type GenericHolder[T any] struct { 69 | Value T 70 | } 71 | 72 | type GenericType struct { 73 | Foo string 74 | } 75 | -------------------------------------------------------------------------------- /gotmpl/gotmpl.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "encoding/json" 19 | "errors" 20 | "fmt" 21 | "os" 22 | "text/template" 23 | ) 24 | 25 | // gotmpl uses [text/template] package to generate a file using 26 | // bodyPath as template body filepath, 27 | // jsonData as data in JSON format, 28 | // outPath as output filepath. 29 | func gotmpl(bodyPath, jsonData, outPath string) error { 30 | if bodyPath == "" { 31 | return errors.New("gotmpl: template body filepath must be set") 32 | } 33 | if outPath == "" { 34 | return errors.New("gotmpl: output filepath must be set") 35 | } 36 | 37 | tmpl, err := template.ParseFiles(bodyPath) 38 | if err != nil { 39 | return fmt.Errorf("gotmpl: cannot parse template body file: %w", err) 40 | } 41 | 42 | var data any 43 | if err = json.Unmarshal(([]byte)(jsonData), &data); err != nil { 44 | return fmt.Errorf("gotmpl: data must be in JSON format: %w", err) 45 | } 46 | 47 | outFile, err := os.Create(outPath) //nolint:gosec // This is a file generation tool that takes filepath as output. 48 | if err != nil { 49 | return fmt.Errorf("gotmpl: cannot create output file: %w", err) 50 | } 51 | defer outFile.Close() 52 | 53 | if err := tmpl.Option("missingkey=error").Execute(outFile, data); err != nil { 54 | return fmt.Errorf("gotmpl: execution failed: %w", err) 55 | } 56 | if err := outFile.Close(); err != nil { 57 | return fmt.Errorf("gotmpl: cannot close output file: %w", err) 58 | } 59 | return nil 60 | } 61 | -------------------------------------------------------------------------------- /githubgen/datatype/fake/mock_generator.go: -------------------------------------------------------------------------------- 1 | // Code generated by moq; DO NOT EDIT. 2 | // github.com/matryer/moq 3 | 4 | package fake 5 | 6 | import ( 7 | "go.opentelemetry.io/build-tools/githubgen/datatype" 8 | "sync" 9 | ) 10 | 11 | // MockGenerator is a mock implementation of datatype.Generator. 12 | // 13 | // func TestSomethingThatUsesGenerator(t *testing.T) { 14 | // 15 | // // make and configure a mocked datatype.Generator 16 | // mockedGenerator := &MockGenerator{ 17 | // GenerateFunc: func(data datatype.GithubData) error { 18 | // panic("mock out the Generate method") 19 | // }, 20 | // } 21 | // 22 | // // use mockedGenerator in code that requires datatype.Generator 23 | // // and then make assertions. 24 | // 25 | // } 26 | type MockGenerator struct { 27 | // GenerateFunc mocks the Generate method. 28 | GenerateFunc func(data datatype.GithubData) error 29 | 30 | // calls tracks calls to the methods. 31 | calls struct { 32 | // Generate holds details about calls to the Generate method. 33 | Generate []struct { 34 | // Data is the data argument value. 35 | Data datatype.GithubData 36 | } 37 | } 38 | lockGenerate sync.RWMutex 39 | } 40 | 41 | // Generate calls GenerateFunc. 42 | func (mock *MockGenerator) Generate(data datatype.GithubData) error { 43 | if mock.GenerateFunc == nil { 44 | panic("MockGenerator.GenerateFunc: method is nil but Generator.Generate was just called") 45 | } 46 | callInfo := struct { 47 | Data datatype.GithubData 48 | }{ 49 | Data: data, 50 | } 51 | mock.lockGenerate.Lock() 52 | mock.calls.Generate = append(mock.calls.Generate, callInfo) 53 | mock.lockGenerate.Unlock() 54 | return mock.GenerateFunc(data) 55 | } 56 | 57 | // GenerateCalls gets all the calls that were made to Generate. 58 | // Check the length with: 59 | // 60 | // len(mockedGenerator.GenerateCalls()) 61 | func (mock *MockGenerator) GenerateCalls() []struct { 62 | Data datatype.GithubData 63 | } { 64 | var calls []struct { 65 | Data datatype.GithubData 66 | } 67 | mock.lockGenerate.RLock() 68 | calls = mock.calls.Generate 69 | mock.lockGenerate.RUnlock() 70 | return calls 71 | } 72 | -------------------------------------------------------------------------------- /multimod/internal/shared/sharedtest/sharedtest_test.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package sharedtest 16 | 17 | import ( 18 | "io" 19 | "log" 20 | "os" 21 | "path/filepath" 22 | "testing" 23 | 24 | "github.com/stretchr/testify/assert" 25 | "github.com/stretchr/testify/require" 26 | ) 27 | 28 | // TestMain performs setup for the tests and suppress printing logs. 29 | func TestMain(m *testing.M) { 30 | log.SetOutput(io.Discard) 31 | os.Exit(m.Run()) 32 | } 33 | 34 | func TestWriteTempFiles(t *testing.T) { 35 | tmpRootDir := t.TempDir() 36 | modFiles := map[string][]byte{ 37 | filepath.Join(tmpRootDir, "test", "test1", "go.mod"): []byte("module \"go.opentelemetry.io/test/test1\"\n\ngo 1.16\n\n" + 38 | "require (\n\t\"go.opentelemetry.io/testroot/v2\" v2.0.0\n)\n"), 39 | filepath.Join(tmpRootDir, "test", "go.mod"): []byte("module go.opentelemetry.io/test3\n\ngo 1.16\n"), 40 | filepath.Join(tmpRootDir, "go.mod"): []byte("module go.opentelemetry.io/testroot/v2\n\ngo 1.16\n"), 41 | filepath.Join(tmpRootDir, "test", "test2", "go.mod"): []byte("module \"go.opentelemetry.io/test/testexcluded\"\n\ngo 1.16\n"), 42 | } 43 | 44 | require.NoError(t, WriteTempFiles(modFiles), "could not create go mod file tree") 45 | 46 | // check all mod files have been written correctly 47 | for modPath, expectedModFile := range modFiles { 48 | actual, err := os.ReadFile(filepath.Clean(modPath)) 49 | 50 | require.NoError(t, err) 51 | assert.Equal(t, expectedModFile, actual) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /chloggen/cmd/new.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "os" 19 | "path/filepath" 20 | "strings" 21 | 22 | "github.com/spf13/cobra" 23 | ) 24 | 25 | var filename string 26 | 27 | func newCmd() *cobra.Command { 28 | cmd := &cobra.Command{ 29 | Use: "new", 30 | Short: "Creates new change file", 31 | RunE: func(cmd *cobra.Command, _ []string) error { 32 | path := filepath.Join(globalCfg.EntriesDir, cleanFileName(filename)) 33 | var pathWithExt string 34 | switch ext := filepath.Ext(path); ext { 35 | case ".yaml": 36 | pathWithExt = path 37 | case ".yml": 38 | pathWithExt = strings.TrimSuffix(path, ".yml") + ".yaml" 39 | default: 40 | pathWithExt = path + ".yaml" 41 | } 42 | 43 | templateBytes, err := os.ReadFile(filepath.Clean(globalCfg.TemplateYAML)) 44 | if err != nil { 45 | return err 46 | } 47 | err = os.WriteFile(pathWithExt, templateBytes, os.FileMode(0644)) 48 | if err != nil { 49 | return err 50 | } 51 | cmd.Printf("Changelog entry template copied to: %s\n", pathWithExt) 52 | return nil 53 | }, 54 | } 55 | cmd.Flags().StringVarP(&filename, "filename", "f", "", "name of the file to add") 56 | if err := cmd.MarkFlagRequired("filename"); err != nil { 57 | cmd.PrintErrf("could not mark filename flag as required: %v", err) 58 | os.Exit(1) 59 | } 60 | return cmd 61 | } 62 | 63 | func cleanFileName(filename string) string { 64 | replace := strings.NewReplacer("/", "_", "\\", "_") 65 | return replace.Replace(filename) 66 | } 67 | -------------------------------------------------------------------------------- /multimod/cmd/root.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package cmd contains the command line interface for multimod. 16 | package cmd 17 | 18 | import ( 19 | "fmt" 20 | "log" 21 | "path/filepath" 22 | 23 | "github.com/spf13/cobra" 24 | 25 | "go.opentelemetry.io/build-tools/internal/repo" 26 | ) 27 | 28 | var versioningFile string 29 | 30 | const ( 31 | defaultVersionsConfigName = "versions" 32 | defaultVersionsConfigType = "yaml" 33 | ) 34 | 35 | // rootCmd represents the base command when called without any subcommands 36 | var rootCmd = &cobra.Command{ 37 | Use: "multimod", 38 | Short: "Enables the release of Go modules with flexible versioning", 39 | Long: `A Golang release versioning and tagging tool that simplifies and 40 | automates versioning for repos with multiple Go modules.`, 41 | } 42 | 43 | // Execute adds all child commands to the root command and sets flags appropriately. 44 | // This is called by main.main(). It only needs to happen once to the rootCmd. 45 | func Execute() { 46 | cobra.CheckErr(rootCmd.Execute()) 47 | } 48 | 49 | func init() { 50 | cobra.OnInitialize() 51 | 52 | repoRoot, err := repo.FindRoot() 53 | if err != nil { 54 | log.Fatalf("could not find repo root: %v", err) 55 | } 56 | 57 | versioningFileDefault := filepath.Join(repoRoot, 58 | fmt.Sprintf("%v.%v", defaultVersionsConfigName, defaultVersionsConfigType)) 59 | rootCmd.PersistentFlags().StringVarP(&versioningFile, "versioning-file", "v", versioningFileDefault, 60 | "Path to versioning file that contains definitions of all module sets. "+ 61 | "If unspecified, defaults to versions.yaml in the Git repo root.") 62 | } 63 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | run: 3 | concurrency: 4 4 | modules-download-mode: readonly 5 | issues-exit-code: 1 6 | tests: true 7 | allow-parallel-runners: true 8 | linters: 9 | enable: 10 | - copyloopvar 11 | - depguard 12 | - errorlint 13 | - gocritic 14 | - gosec 15 | - misspell 16 | - revive 17 | - unconvert 18 | - unparam 19 | - usetesting 20 | settings: 21 | depguard: 22 | rules: 23 | main: 24 | deny: 25 | - pkg: sync/atomic 26 | desc: Use go.uber.org/atomic instead of sync/atomic 27 | - pkg: github.com/pkg/errors 28 | desc: Use 'errors' or 'fmt' instead of github.com/pkg/errors 29 | non-tests: 30 | files: 31 | - '!$test' 32 | - '!**/*test/*.go' 33 | deny: 34 | - pkg: testing 35 | - pkg: github.com/stretchr/testify 36 | govet: 37 | disable: 38 | - fieldalignment 39 | enable-all: true 40 | settings: 41 | printf: 42 | funcs: 43 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof 44 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf 45 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf 46 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf 47 | misspell: 48 | locale: US 49 | ignore-rules: 50 | - cancelled 51 | - metre 52 | - meter 53 | - metres 54 | - kilometre 55 | - kilometres 56 | exclusions: 57 | generated: lax 58 | presets: 59 | - std-error-handling 60 | rules: 61 | - linters: 62 | - gosec 63 | text: 'G404:' 64 | - linters: 65 | - gosec 66 | text: 'G402:' 67 | - linters: 68 | - gosec 69 | text: 'G112:' 70 | paths: 71 | - third_party$ 72 | - builtin$ 73 | - examples$ 74 | formatters: 75 | enable: 76 | - gofmt 77 | - goimports 78 | settings: 79 | gofmt: 80 | simplify: true 81 | goimports: 82 | local-prefixes: 83 | - go.opentelemetry.io/build-tools 84 | exclusions: 85 | generated: lax 86 | paths: 87 | - third_party$ 88 | - builtin$ 89 | - examples$ 90 | -------------------------------------------------------------------------------- /versions.yaml: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module-sets: 16 | tools: 17 | version: v0.29.0 18 | modules: 19 | - go.opentelemetry.io/build-tools 20 | - go.opentelemetry.io/build-tools/checkapi 21 | - go.opentelemetry.io/build-tools/checkfile 22 | - go.opentelemetry.io/build-tools/chloggen 23 | - go.opentelemetry.io/build-tools/crosslink 24 | - go.opentelemetry.io/build-tools/dbotconf 25 | - go.opentelemetry.io/build-tools/githubgen 26 | - go.opentelemetry.io/build-tools/gotmpl 27 | - go.opentelemetry.io/build-tools/issuegenerator 28 | - go.opentelemetry.io/build-tools/multimod 29 | 30 | excluded-modules: 31 | - go.opentelemetry.io/build-tools/internal/tools 32 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/altpkg/receiver/altreceiver 33 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/altpkg/receiver/badreceiver 34 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/badpkg/receiver/badreceiver 35 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/badpkg/receiver/bad2receiver 36 | - foo/bar/pkg/pkg 37 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/testpkg/receiver/validreceiver 38 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/testpkg/receiver/unkeyedreceiver 39 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/badconfigreceiver 40 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/configreceiver 41 | - github.com/open-telemetry/opentelemetry-go-build-tools/checkapi/internal/config/receiver/configreceiver/someothermodule 42 | -------------------------------------------------------------------------------- /chloggen/cmd/root.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package cmd provides the command line interface for the chloggen tool. 16 | package cmd 17 | 18 | import ( 19 | "fmt" 20 | "os" 21 | 22 | "github.com/spf13/cobra" 23 | 24 | "go.opentelemetry.io/build-tools/chloggen/internal/config" 25 | ) 26 | 27 | var ( 28 | configFile string 29 | globalCfg *config.Config 30 | ) 31 | 32 | func rootCmd() *cobra.Command { 33 | cmd := &cobra.Command{ 34 | Use: "chloggen", 35 | Short: "Updates CHANGELOG.MD to include all new changes", 36 | Long: `chloggen is a tool used to automate the generation of CHANGELOG files using individual yaml files as the source.`, 37 | } 38 | cmd.SetOut(os.Stdout) 39 | cmd.PersistentFlags().StringVar(&configFile, "config", "", "(optional) chloggen config file") 40 | cmd.AddCommand(newCmd()) 41 | cmd.AddCommand(updateCmd()) 42 | cmd.AddCommand(validateCmd()) 43 | return cmd 44 | } 45 | 46 | // Execute executes the root command. 47 | func Execute() { 48 | cobra.CheckErr(rootCmd().Execute()) 49 | } 50 | 51 | func init() { 52 | cobra.OnInitialize(initConfig) 53 | } 54 | 55 | func initConfig() { 56 | // Don't override if already set in tests 57 | if globalCfg != nil { 58 | return 59 | } 60 | 61 | if configFile == "" { 62 | globalCfg = config.New(repoRoot()) 63 | } else { 64 | var err error 65 | globalCfg, err = config.NewFromFile(repoRoot(), configFile) 66 | if err != nil { 67 | fmt.Printf("FAIL: Could not load config file: %s\n", err.Error()) 68 | os.Exit(1) 69 | } 70 | } 71 | } 72 | 73 | func repoRoot() string { 74 | dir, err := os.Getwd() 75 | if err != nil { 76 | // This is not expected, but just in case 77 | fmt.Println("FAIL: Could not determine current working directory") 78 | } 79 | return dir 80 | } 81 | -------------------------------------------------------------------------------- /checkfile/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The OpenTelemetry Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "flag" 19 | ) 20 | 21 | const ( 22 | // Absolute root path of the project 23 | projectPathFlag = "project-path" 24 | // Relative path where imports all default components 25 | relativeDefaultComponentsPathFlag = "component-rel-path" 26 | // The project Go Module name 27 | projectGoModuleFlag = "module-name" 28 | // The name of the file to validate 29 | fileNameFlag = "file-name" 30 | ) 31 | 32 | // The main verifies if filename exists for the enabled default components 33 | // in OpenTelemetry core and contrib repository. 34 | // Usage in the core repo: 35 | // 36 | // checkfile --project-path path/to/project \ 37 | // --component-rel-path service/defaultcomponents/defaults.go \ 38 | // --module-name go.opentelemetry.io/collector 39 | // --file-name README.md 40 | // 41 | // Usage in the contrib repo: 42 | // 43 | // checkfile --project-path path/to/project \ 44 | // --component-rel-path cmd/otelcontrib/components.go \ 45 | // --module-name github.com/open-telemetry/opentelemetry-collector-contrib 46 | // --file-name metadata.yaml 47 | func main() { 48 | projectPath := flag.String(projectPathFlag, "", "specify the project path") 49 | componentPath := flag.String(relativeDefaultComponentsPathFlag, "", "specify the relative component path") 50 | moduleName := flag.String(projectGoModuleFlag, "", "specify the project go module") 51 | fileName := flag.String(fileNameFlag, "", "specify the file name") 52 | 53 | flag.Parse() 54 | 55 | if *fileName == "" { 56 | panic("Missing required argument: --file-name") 57 | } 58 | 59 | err := FileExists( 60 | *projectPath, 61 | *componentPath, 62 | *moduleName, 63 | *fileName, 64 | ) 65 | 66 | if err != nil { 67 | panic(err) 68 | } 69 | } 70 | --------------------------------------------------------------------------------